Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- reddit
|
4 |
+
metrics:
|
5 |
+
- rouge
|
6 |
+
---
|
7 |
+
|
8 |
+
[Distilbart-cnn-6-6](https://huggingface.co/sshleifer/distilbart-cnn-6-6) finetuned on the [reddit dataset](https://huggingface.co/datasets/reddit)
|
9 |
+
|
10 |
+
Example usage:
|
11 |
+
|
12 |
+
```python
|
13 |
+
# Load finetuned model
|
14 |
+
tokenizer = BartTokenizer.from_pretrained("NielsV/distilbart-cnn-6-6-reddit")
|
15 |
+
model = BartForConditionalGeneration.from_pretrained("NielsV/distilbart-cnn-6-6-reddit")
|
16 |
+
|
17 |
+
input_text = "..." # The text you want summarized
|
18 |
+
|
19 |
+
# Tokenize the text, summarize and decode the result
|
20 |
+
inputs = tokenizer(input_txt, max_length=1024, return_tensors="pt")
|
21 |
+
summary_ids = model.generate(inputs["input_ids"], num_beams=2, min_length=0, max_length=60)
|
22 |
+
summary = tokenizer.batch_decode(summary_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
23 |
+
|
24 |
+
# The string summary contains the tldr
|
25 |
+
```
|
26 |
+
|
27 |
+
For more information, check out [this repository](https://github.com/VerleysenNiels/arxiv-summarizer)
|