AventIQ-AI / T5-small-grammar-correction

huggingface.co
Total runs: 37
24-hour runs: -1
7-day runs: -26
30-day runs: -88
Model's Last Updated: February 28 2025

Introduction of T5-small-grammar-correction

Model Details of T5-small-grammar-correction

Grammar Correction with Text-to-Text Transfer Transformer

📌 Overview

This repository hosts the quantized version of the T5 model fine-tuned for Grammar Correction. The model has been trained on the JFLEG dataset from Hugging Face to enhance grammatical accuracy in given text inputs. The model is quantized to Float16 (FP16) to optimize inference speed and efficiency while maintaining high performance.

🏗 Model Details
  • Model Architecture: t5-small
  • Task: Grammar Correction
  • Dataset: Hugging Face's jfleg
  • Quantization: Float16 (FP16) for optimized inference
  • Fine-tuning Framework: Hugging Face Transformers
🚀 Usage
Installation
pip install transformers torch
Loading the Model
from transformers import T5Tokenizer, T5ForConditionalGeneration
import torch

device = "cuda" if torch.cuda.is_available() else "cpu"

model_name = "AventIQ-AI/t5-small-grammar-correction"
model = T5ForConditionalGeneration.from_pretrained(model_name).to(device)
tokenizer = T5Tokenizer.from_pretrained(model_name)
Grammar Correction Inference
def correct_grammar(text, model, tokenizer, device):
    prefix = "correct grammar: "
    input_text = prefix + text
    input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
    outputs = model.generate(
        input_ids,
        max_length=128,
        num_beams=5,
        early_stopping=True,
    )
    corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return corrected_text

# 🔍 Test Example
test_sentences = [
    "He go to the store yesterday.",
    "They was running in the park.",
    "She dont like pizza.",
    "We has completed the project already.",
]
for sentence in test_sentences:
    corrected = correct_grammar(sentence, model, tokenizer, device)
    print(f"Original: {sentence}")
    print(f"Corrected: {corrected}")
    print("---")
📊 Evaluation Metric: BLEU Score

For grammar correction, a high BLEU score indicates that the model’s corrected sentences closely match human-annotated corrections.

Interpreting Our BLEU Score

Our model achieved a BLEU score of 0.8888 , which indicates:
✅ Good grammar correction ability
✅ Moderate sentence fluency

BLEU is computed by comparing the 1-gram, 2-gram, 3-gram, and 4-gram overlaps between the model’s output and the reference sentence while applying a brevity penalty if the model generates shorter sentences.

BLEU Score Ranges for Grammar Correction
BLEU Score Interpretation
0.8 - 1.0 Near-perfect corrections, closely matching human annotations.
0.7 - 0.8 High-quality corrections, minor variations in phrasing.
0.6 - 0.7 Good corrections, but with some grammatical errors or missing words. ✅ (Our Model)
0.5 - 0.6 Decent corrections, noticeable mistakes, lacks fluency.
Below 0.5 Needs improvement, frequent incorrect corrections.
⚡ Quantization Details

Post-training quantization was applied using PyTorch's built-in quantization framework. The model was quantized to Float16 (FP16) to reduce model size and improve inference efficiency while balancing accuracy.

📂 Repository Structure
.
├── model/               # Contains the quantized model files
├── tokenizer_config/    # Tokenizer configuration and vocabulary files
├── model.safetensors/   # Quantized Model
├── README.md            # Model documentation
⚠️ Limitations
  • The model may struggle with highly ambiguous sentences.
  • Quantization may lead to slight degradation in accuracy compared to full-precision models.
  • Performance may vary across different writing styles and sentence structures.
🤝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.

Runs of AventIQ-AI T5-small-grammar-correction on huggingface.co

37
Total runs
-1
24-hour runs
-13
3-day runs
-26
7-day runs
-88
30-day runs

More Information About T5-small-grammar-correction huggingface.co Model

T5-small-grammar-correction huggingface.co

T5-small-grammar-correction huggingface.co is an AI model on huggingface.co that provides T5-small-grammar-correction's model effect (), which can be used instantly with this AventIQ-AI T5-small-grammar-correction model. huggingface.co supports a free trial of the T5-small-grammar-correction model, and also provides paid use of the T5-small-grammar-correction. Support call T5-small-grammar-correction model through api, including Node.js, Python, http.

T5-small-grammar-correction huggingface.co Url

https://huggingface.co/AventIQ-AI/T5-small-grammar-correction

AventIQ-AI T5-small-grammar-correction online free

T5-small-grammar-correction huggingface.co is an online trial and call api platform, which integrates T5-small-grammar-correction's modeling effects, including api services, and provides a free online trial of T5-small-grammar-correction, you can try T5-small-grammar-correction online for free by clicking the link below.

AventIQ-AI T5-small-grammar-correction online free url in huggingface.co:

https://huggingface.co/AventIQ-AI/T5-small-grammar-correction

T5-small-grammar-correction install

T5-small-grammar-correction is an open source model from GitHub that offers a free installation service, and any user can find T5-small-grammar-correction on GitHub to install. At the same time, huggingface.co provides the effect of T5-small-grammar-correction install, users can directly use T5-small-grammar-correction installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

T5-small-grammar-correction install url in huggingface.co:

https://huggingface.co/AventIQ-AI/T5-small-grammar-correction

Url of T5-small-grammar-correction

T5-small-grammar-correction huggingface.co Url

Provider of T5-small-grammar-correction huggingface.co

AventIQ-AI
ORGANIZATIONS

Other API from AventIQ-AI