Update README.md
Browse files
README.md
CHANGED
|
@@ -8,7 +8,7 @@ tags:
|
|
| 8 |
license: mit
|
| 9 |
|
| 10 |
widget:
|
| 11 |
-
- text: "
|
| 12 |
---
|
| 13 |
|
| 14 |
# ViT5-large Finetuned on `vietnews` Abstractive Summarization
|
|
@@ -28,29 +28,16 @@ tokenizer = AutoTokenizer.from_pretrained("VietAI/vit5-large-vietnews-summarizat
|
|
| 28 |
model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large-vietnews-summarization")
|
| 29 |
model.cuda()
|
| 30 |
|
| 31 |
-
sentence = "
|
| 32 |
text = "vietnews: " + sentence + " </s>"
|
| 33 |
encoding = tokenizer(text, return_tensors="pt")
|
| 34 |
input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
|
| 35 |
outputs = model.generate(
|
| 36 |
input_ids=input_ids, attention_mask=attention_masks,
|
| 37 |
-
max_length=
|
| 38 |
early_stopping=True
|
| 39 |
)
|
| 40 |
for output in outputs:
|
| 41 |
line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
| 42 |
print(line)
|
| 43 |
```
|
| 44 |
-
|
| 45 |
-
## Citation
|
| 46 |
-
```
|
| 47 |
-
@inproceedings{phan-etal-2022-vit5,
|
| 48 |
-
title = "{V}i{T}5: Pretrained Text-to-Text Transformer for {V}ietnamese Language Generation",
|
| 49 |
-
author = "Phan, Long and Tran, Hieu and Nguyen, Hieu and Trinh, Trieu H.",
|
| 50 |
-
booktitle = "Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies: Student Research Workshop",
|
| 51 |
-
year = "2022",
|
| 52 |
-
publisher = "Association for Computational Linguistics",
|
| 53 |
-
url = "https://aclanthology.org/2022.naacl-srw.18",
|
| 54 |
-
pages = "136--142",
|
| 55 |
-
}
|
| 56 |
-
```
|
|
|
|
| 8 |
license: mit
|
| 9 |
|
| 10 |
widget:
|
| 11 |
+
- text: "Input text."
|
| 12 |
---
|
| 13 |
|
| 14 |
# ViT5-large Finetuned on `vietnews` Abstractive Summarization
|
|
|
|
| 28 |
model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large-vietnews-summarization")
|
| 29 |
model.cuda()
|
| 30 |
|
| 31 |
+
sentence = "Input text"
|
| 32 |
text = "vietnews: " + sentence + " </s>"
|
| 33 |
encoding = tokenizer(text, return_tensors="pt")
|
| 34 |
input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
|
| 35 |
outputs = model.generate(
|
| 36 |
input_ids=input_ids, attention_mask=attention_masks,
|
| 37 |
+
max_length=128,
|
| 38 |
early_stopping=True
|
| 39 |
)
|
| 40 |
for output in outputs:
|
| 41 |
line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
| 42 |
print(line)
|
| 43 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|