Question Answering
Transformers
PyTorch
TensorFlow
JAX
Vietnamese
t5
text2text-generation
summarization
translation
text-generation-inference
Instructions to use VietAI/vit5-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VietAI/vit5-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("question-answering", model="VietAI/vit5-large")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("VietAI/vit5-large") model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -22,19 +22,6 @@ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
| 22 |
tokenizer = AutoTokenizer.from_pretrained("VietAI/vit5-large")
|
| 23 |
model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large")
|
| 24 |
model.cuda()
|
| 25 |
-
|
| 26 |
-
sentence = "VietAI là tổ chức phi lợi nhuận với sứ mệnh ươm mầm tài năng về trí tuệ nhân tạo và xây dựng một cộng đồng các chuyên gia trong lĩnh vực trí tuệ nhân tạo đẳng cấp quốc tế tại Việt Nam."
|
| 27 |
-
text = "vi: " + sentence
|
| 28 |
-
encoding = tokenizer(text, return_tensors="pt")
|
| 29 |
-
input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
|
| 30 |
-
outputs = model.generate(
|
| 31 |
-
input_ids=input_ids, attention_mask=attention_masks,
|
| 32 |
-
max_length=256,
|
| 33 |
-
early_stopping=True
|
| 34 |
-
)
|
| 35 |
-
for output in outputs:
|
| 36 |
-
line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
|
| 37 |
-
print(line)
|
| 38 |
```
|
| 39 |
|
| 40 |
## Citation
|
|
|
|
| 22 |
tokenizer = AutoTokenizer.from_pretrained("VietAI/vit5-large")
|
| 23 |
model = AutoModelForSeq2SeqLM.from_pretrained("VietAI/vit5-large")
|
| 24 |
model.cuda()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
```
|
| 26 |
|
| 27 |
## Citation
|