sana-ngu commited on
Commit
71b178a
·
1 Parent(s): f655bf1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -0
README.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
2
+ import torch
3
+ model = T5ForConditionalGeneration.from_pretrained("sana-ngu/HaT5")
4
+ tokenizer = T5Tokenizer.from_pretrained("t5-base") # use the source tokenizer because T5 finetuned tokenizer breaks
5
+ tokenizer.pad_token = tokenizer.eos_token
6
+ input_ids = tokenizer("Old lions in the wild lay down and die with dignity when they can't hunt anymore. If a government is having 'teething problems' handling aid supplies one full year into a pandemic, maybe it should take a cue and get the fuck out of the way? ", padding=True, truncation=True, return_tensors='pt').input_ids
7
+ outputs = model.generate(input_ids)
8
+ pred = tokenizer.decode(outputs[0], skip_special_tokens=True)
9
+ print(pred)