Downloads · 30 days
8
5% of all-time downloads
anuvid/ai-grammar-correction-model
ai-grammar-correction-model is a text generation model from anuvid. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
This is a sequence-to-sequence transformer model fine-tuned for Grammatical Error Correction (GEC) based on google/flan-t5-base.
Downloads · 30 days
8
5% of all-time downloads
All-time downloads
172
Public
Parameters
248M
990 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors990 MB · 100%
From the Hugging Face model README
This is a sequence-to-sequence transformer model fine-tuned for Grammatical Error Correction (GEC) based on google/flan-t5-base.
It automatically detects and corrects grammatical, syntactical, and stylistic errors in English sentences, returning fluent, natural corrections.
google/flan-t5-base"grammar: <input_text>"Fine-tuned on a curated dataset of 100,000 sentence pairs:
| Metric | Test Score |
|---|---|
| BLEU | 0.6869 |
| GLEU | 0.8311 |
| ROUGE-1 | 0.8819 |
| ROUGE-2 | 0.7698 |
| ROUGE-L | 0.8748 |
| Exact Match Accuracy | 0.0886 |
| Word Accuracy | 0.5018 |
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
MODEL_ID = "anuvid/ai-grammar-correction-model"
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_ID)
text = "She go to school yesterday."
inputs = tokenizer(f"grammar: {text}", return_tensors="pt")
outputs = model.generate(**inputs, max_length=128, num_beams=4, early_stopping=True)
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("Original :", text)
print("Corrected:", corrected_text)
# Output: "She went to school yesterday."
| Original Input | Model Output |
|---|---|
She go to school yesterday. | She went to school yesterday. |
He don't likes playing football. | He doesn't like playing football. |
I has a meeting tomorrow. | I have a meeting tomorrow. |
They was going to the market. | They were going to the market. |
This are a very good book. | This is a very good book. |