Update README.md
Browse files
README.md
CHANGED
|
@@ -8,3 +8,21 @@ datasets:
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# Get Grammatical corrections on your English text, trained on a subset of c4-200m dataset - ONNX Quantized Model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# Get Grammatical corrections on your English text, trained on a subset of c4-200m dataset - ONNX Quantized Model
|
| 11 |
+
|
| 12 |
+
# Use the below code for running the model
|
| 13 |
+
|
| 14 |
+
``` python
|
| 15 |
+
|
| 16 |
+
from transformers import AutoTokenizer
|
| 17 |
+
from optimum.onnxruntime import ORTModelForSeq2SeqLM
|
| 18 |
+
from optimum.pipelines import pipeline
|
| 19 |
+
|
| 20 |
+
tokenizer = AutoTokenizer.from_pretrained("leslyarun/grammatical-error-correction-quantized")
|
| 21 |
+
model = ORTModelForSeq2SeqLM.from_pretrained("leslyarun/grammatical-error-correction-quantized",
|
| 22 |
+
encoder_file_name="encoder_model_quantized.onnx",
|
| 23 |
+
decoder_file_name="decoder_model_quantized.onnx",
|
| 24 |
+
decoder_with_past_file_name="decoder_with_past_model_quantized.onnx")
|
| 25 |
+
|
| 26 |
+
text2text_generator = pipeline("text2text-generation", model=model, tokenizer=tokenizer)
|
| 27 |
+
output = text2text_generator("grammar: " + sentence)
|
| 28 |
+
print(output[0]["generated_text"])
|