joaojaneiro commited on
Commit
80b119a
1 Parent(s): 48a5b10

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This model is an implementation of the paper [A Simple Recipe for Multilingual Grammatical Error Correction](https://arxiv.org/pdf/2106.03830.pdf) from Google where they report the State of the art score in the task of Grammatical Error Correction (GEC).
2
+ We implement the version with the T5-small with the reported F_0.5 score in the paper (60.70).
3
+
4
+ In order to use the model, look at the following snippet:
5
+ ```python
6
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
7
+
8
+ model = T5ForConditionalGeneration.from_pretrained("Unbabel/gec-t5_small")
9
+ tokenizer = T5Tokenizer.from_pretrained('t5-small')
10
+
11
+ sentence = "I like to swimming"
12
+ tokenized_sentence = tokenizer('gec: ' + sentence, max_length=128, truncation=True, padding='max_length', return_tensors='pt')
13
+ corrected_sentence = tokenizer.decode(
14
+ model.generate(
15
+ input_ids = tokenized_sentence.input_ids,
16
+ attention_mask = tokenized_sentence.attention_mask,
17
+ max_length=128,
18
+ num_beams=5,
19
+ early_stopping=True,
20
+ )[0],
21
+ skip_special_tokens=True,
22
+ clean_up_tokenization_spaces=True
23
+ )
24
+ print(corrected_sentence) # -> I like swimming.
25
+ ```