Views
No views yet
| Metric | Score |
|---|---|
| ROUGE-1 | 26.89 |
| ROUGE-2 | 6.94 |
| ROUGE-L | 21.28 |
| Loss | 2.54 |
| Avg. Length | 18.77 tokens |
1from transformers import pipeline
2
3summarizer = pipeline("summarization", model="sysresearch101/t5-large-finetuned-xsum")
4
5article = "Your article text here..."
6summary = summarizer(article, max_length=80, min_length=20, do_sample=False)
7print(summary[0]['summary_text'])1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3tokenizer = AutoTokenizer.from_pretrained("sysresearch101/t5-large-finetuned-xsum")
4model = AutoModelForSeq2SeqLM.from_pretrained("sysresearch101/t5-large-finetuned-xsum")
5
6inputs = tokenizer("summarize: " + article, return_tensors="pt", max_length=512, truncation=True)
7outputs = model.generate(
8 **inputs,
9 max_length=80,
10 min_length=20,
11 num_beams=4,
12 no_repeat_ngram_size=2,
13 length_penalty=1.0,
14 repetition_penalty=2.5,
15 use_cache=True,
16 early_stopping=True
17 do_sample = True,
18 temperature = 0.8,
19 top_k = 50,
20 top_p = 0.95
21)
22
23summary = tokenizer.decode(outputs[0], skip_special_tokens=True)1@misc{stept2023_t5_large_xsum,
2 author = {Shlomo Stept (sysresearch101)},
3 title = {T5-Large Fine-tuned on XSum for Abstractive Summarization},
4 year = {2023},
5 publisher = {Hugging Face},
6 url = {https://huggingface.co/sysresearch101/t5-large-finetuned-xsum}
7}