Views
No views yet
1from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
2tokenizer = AutoTokenizer.from_pretrained("KES/GEC-English")
3model = AutoModelForSeq2SeqLM.from_pretrained("KES/GEC-English")
4text = "Ah waan ah phone"
5inputs = tokenizer("guy:"+text, truncation=True, return_tensors='pt')
6output = model.generate(inputs['input_ids'], num_beams=4, max_length=512, early_stopping=True)
7translation=tokenizer.batch_decode(output, skip_special_tokens=True)
8print("".join(translation)) #translation: I want a phone.