Commit
·
b9f9195
1
Parent(s):
d1d3f58
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
2 |
+
|
3 |
+
GED_TOKENIZER = AutoTokenizer.from_pretrained("zuu/grammar-error-correcter")
|
4 |
+
GED_MODEL = AutoModelForSeq2SeqLM.from_pretrained("zuu/grammar-error-correcter")
|
5 |
+
|
6 |
+
# Incorrect text
|
7 |
+
incorrect_text = 'young children should avoid exposure to contageous disease'
|
8 |
+
|
9 |
+
# Tokenize text
|
10 |
+
tokens= GED_TOKENIZER(
|
11 |
+
[incorrect_text],
|
12 |
+
padding=True,
|
13 |
+
return_tensors='pt'
|
14 |
+
)
|
15 |
+
|
16 |
+
corrections = GED_MODEL.generate(**tokens)
|
17 |
+
corrections = GED_TOKENIZER.batch_decode(
|
18 |
+
corrections,
|
19 |
+
skip_special_tokens=True
|
20 |
+
)
|
21 |
+
corrections
|