YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

AI Grammar Correction โ€” Fine-tuned FLAN-T5

Model Description

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.

Task Details

  • Task: Grammatical Error Correction (GEC)
  • Base Architecture: google/flan-t5-base
  • Input Prefix: "grammar: <input_text>"
  • Max Sequence Length: 128 tokens

Dataset Specifications

Fine-tuned on a curated dataset of 100,000 sentence pairs:

  • Train Set: 80,000 pairs (80%)
  • Validation Set: 10,000 pairs (10%)
  • Test Set: 10,000 pairs (10%)

Evaluation Results (10,000 Unseen Test Examples)

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

How to Use

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."

Example Corrections

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.
Downloads last month
114
Safetensors
Model size
0.2B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support