razent commited on
Commit
e49d9bf
1 Parent(s): 931b33a

Create README.md

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