Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ViT5-large
|
2 |
+
|
3 |
+
State-of-the-art pre-trained Transformber-based encoder-decoder model for Vietnamese.
|
4 |
+
|
5 |
+
## How to use
|
6 |
+
For more details, do check out [our Github repo](https://github.com/justinphan3110/ViT5).
|
7 |
+
```python
|
8 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
9 |
+
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("VietAI/vit5-large")
|
11 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large")
|
12 |
+
|
13 |
+
sentence = "Xin chào"
|
14 |
+
text = "summarize: " + sentence + " </s>"
|
15 |
+
encoding = tokenizer.encode_plus(text, pad_to_max_length=True, return_tensors="pt")
|
16 |
+
input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
|
17 |
+
outputs = model.generate(
|
18 |
+
input_ids=input_ids, attention_mask=attention_masks,
|
19 |
+
max_length=256,
|
20 |
+
early_stopping=True
|
21 |
+
)
|
22 |
+
for output in outputs:
|
23 |
+
line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
24 |
+
print(line)
|
25 |
+
```
|
26 |
+
|
27 |
+
## Citation
|
28 |
+
```
|
29 |
+
Coming Soon...
|
30 |
+
```
|