File size: 1,008 Bytes
ca0c5a5 e87cefc efa66d4 68bfa75 cbce804 d82f89e d0ffe50 fb396bb cd9ab14 57c57f1 39f06cd 57c57f1 39f06cd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
---
language:
- vi
tags:
- pytorch
- causal-lm
- text-generation
---
# GPT-J 6B on Vietnamese News
Details will be available soon.
For more information, please contact [email protected] (Dương) / [email protected] (Thành) / [email protected] (Bình).
### How to use
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("VietAI/gpt-j-6B-vietnamese-news")
model = AutoModelForCausalLM.from_pretrained("VietAI/gpt-j-6B-vietnamese-news", low_cpu_mem_usage=True)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
prompt = "Tiềm năng của trí tuệ nhân tạo" # your input sentence
input_ids = tokenizer(prompt, return_tensors="pt")['input_ids'].to(device)
gen_tokens = model.generate(
input_ids,
max_length=max_length,
do_sample=True,
temperature=0.9,
top_k=20,
)
gen_text = tokenizer.batch_decode(gen_tokens)[0]
print(gen_text)
``` |