Views
No views yet
| Metric | Score (%) |
|---|---|
| ROUGE-1 | 83.3 |
| ROUGE-2 | 60.0 |
| ROUGE-L | 83.3 |
| ROUGE-Lsum | 83.3 |
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2
3tokenizer = AutoTokenizer.from_pretrained("your-username/your-model-name")
4model = AutoModelForSeq2SeqLM.from_pretrained("your-username/your-model-name")
5
6text = "The stock market saw a significant drop today due to rising inflation concerns. Investors are cautious ahead of the Federal Reserve's upcoming decision."
7
8inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
9summary_ids = model.generate(**inputs, max_length=150, num_beams=4, early_stopping=True)
10
11print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))