duongna commited on
Commit
b90450b
1 Parent(s): 1181f78

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -1
README.md CHANGED
@@ -11,4 +11,29 @@ tags:
11
 
12
  Details will be available soon.
13
 
14
- For more information, please contact [email protected] (Dương) / [email protected] (Thành) / [email protected] (Bình).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  Details will be available soon.
13
 
14
+ For more information, please contact [email protected] (Dương) / [email protected] (Thành) / [email protected] (Bình).
15
+
16
+ ### How to use
17
+ ```python
18
+ from transformers import AutoTokenizer, AutoModelForCausalLM
19
+
20
+ tokenizer = AutoTokenizer.from_pretrained("VietAI/gpt-neo-1.3B-vietnamese-news")
21
+ model = AutoModelForCausalLM.from_pretrained("VietAI/gpt-neo-1.3B-vietnamese-news")
22
+
23
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
24
+ model.to(device)
25
+
26
+ prompt = "Tiềm năng của trí tuệ nhân tạo" # your input sentence
27
+ input_ids = tokenizer(prompt, return_tensors="pt")['input_ids'].to(device)
28
+
29
+ gen_tokens = model.generate(
30
+ input_ids,
31
+ max_length=max_length,
32
+ do_sample=True,
33
+ temperature=0.9,
34
+ top_k=20,
35
+ )
36
+
37
+ gen_text = tokenizer.batch_decode(gen_tokens)[0]
38
+ print(gen_text)
39
+ ```