machineteacher
commited on
Commit
•
8fd6cef
1
Parent(s):
804e0da
Update README.md
Browse files
README.md
CHANGED
@@ -68,15 +68,10 @@ from transformers import AutoTokenizer, T5ForConditionalGeneration
|
|
68 |
|
69 |
tokenizer = AutoTokenizer.from_pretrained("grammarly/coedit-large")
|
70 |
model = T5ForConditionalGeneration.from_pretrained("grammarly/coedit-large")
|
71 |
-
input_text =
|
72 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
73 |
outputs = model.generate(input_ids, max_length=256)
|
74 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)[0]
|
75 |
-
|
76 |
-
before_input = 'Fix grammatical errors in this sentence: New kinds of vehicles will be invented with new technology than today.'
|
77 |
-
model_input = tokenizer(before_input, return_tensors='pt')
|
78 |
-
model_outputs = model.generate(**model_input, num_beams=8, max_length=1024)
|
79 |
-
after_text = tokenizer.batch_decode(model_outputs, skip_special_tokens=True)[0]
|
80 |
```
|
81 |
|
82 |
|
|
|
68 |
|
69 |
tokenizer = AutoTokenizer.from_pretrained("grammarly/coedit-large")
|
70 |
model = T5ForConditionalGeneration.from_pretrained("grammarly/coedit-large")
|
71 |
+
input_text = 'Fix grammatical errors in this sentence: New kinds of vehicles will be invented with new technology than today.'
|
72 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
73 |
outputs = model.generate(input_ids, max_length=256)
|
74 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)[0]
|
|
|
|
|
|
|
|
|
|
|
75 |
```
|
76 |
|
77 |
|