Views
No views yet
facebook/bart-base fine-tuned on the XSum dataset for abstractive
single-sentence news summarization. It is intended to summarize BBC-style news
articles into concise summaries.facebook/bart-baseEdinburghNLP/xsum| Metric | Value |
|---|---|
| ROUGE-1 | 0.3938 |
| ROUGE-2 | 0.1696 |
| ROUGE-L | 0.3197 |
| ROUGE-Lsum | 0.3196 |
| BERTScore precision mean | 0.9136 |
| BERTScore recall mean | 0.9000 |
| BERTScore F1 mean | 0.9066 |
roberta-base.1from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
2
3repo_id = "Eymeee/xsum-bart-summarizer"
4
5tokenizer = AutoTokenizer.from_pretrained(repo_id)
6model = AutoModelForSeq2SeqLM.from_pretrained(repo_id)
7
8article = """
9The government announced a new transport plan after months of consultation with
10local councils and passenger groups. Ministers said the proposal would improve
11bus and rail services, reduce delays, and give local authorities more control
12over routes and fares.
13"""
14
15inputs = tokenizer(
16 article,
17 return_tensors="pt",
18 max_length=512,
19 truncation=True,
20)
21output_ids = model.generate(
22 **inputs,
23 num_beams=4,
24 length_penalty=2.0,
25 max_length=64,
26 no_repeat_ngram_size=3,
27 early_stopping=True,
28)
29summary = tokenizer.decode(output_ids[0], skip_special_tokens=True)
30print(summary)