This is a derivative work. All credit for the original model goes to Vennify (Eric Fillion). This repository only provides a quantized ONNX conversion for easier deployment. We do not claim ownership of the model architecture or weights.
Benchmarked on a 50-sentence English grammar correction test set (2-thread CPU, Google Colab).
Quality
Format
BLEU
chrF++
Exact Match
Δ BLEU
Δ chrF++
PyTorch FP32 (baseline)
78.57
87.87
58%
—
—
ONNX INT8 (this repo)
77.24
86.74
56%
-1.33
-1.13
Speed & Size
Metric
PyTorch FP32
ONNX INT8 (this repo)
P50 Latency
539 ms
224 ms
P95 Latency
708 ms
459 ms
Disk Size
850 MB
426 MB
Throughput
—
17.21 sentences/sec
Quantization Stability
Metric
Value
Sentences with changed output (INT8 vs FP32)
6/50 sentences changed
Deployment Scorecard Verdict
GO
Highest baseline quality but large size (426 MB INT8). INT8 introduced some language-switching artifacts on edge cases.
Cross-Model Comparison (7 Models Benchmarked)
This model was benchmarked alongside 6 other grammar correction models. All models were evaluated on the same 50-sentence test set under identical conditions.
chrF++ 86.74, but 3x larger than coedit-small for no significant quality gain
Usage
python
1from optimum.onnxruntime import ORTModelForSeq2SeqLM
2from transformers import AutoTokenizer
34model_id ="YOUR_USERNAME/vennify-t5-base-grammar-correction-onnx-int8"5tokenizer = AutoTokenizer.from_pretrained(model_id)6model = ORTModelForSeq2SeqLM.from_pretrained(model_id)78text ="grammar: She go to school yesterday"9inputs = tokenizer([text], return_tensors="pt", max_length=128, truncation=True)10outputs = model.generate(**inputs, max_new_tokens=128, num_beams=1, repetition_penalty=1.3)11corrected = tokenizer.decode(outputs[0], skip_special_tokens=True)12print(corrected)
Input prefix:grammar:
Acknowledgments
All credit for the original model goes to Vennify (Eric Fillion). This repository only provides an ONNX INT8 quantized conversion to make the model easier to deploy in production environments (mobile, edge, browser).
Quantization and benchmarking performed as part of the Smart Desktop Keyboard Grammar Engine project.
Citation
If you use this model, please cite the original authors:
@misc{vennify_t5_base_onnx_int8,
title = {vennify/t5-base-grammar-correction — ONNX INT8 Quantized},
note = {Quantized version of vennify/t5-base-grammar-correction},
url = {https://huggingface.co/vennify/t5-base-grammar-correction},
}