CoolFace
Modelpublic

samadpls/t5-base-grammar-checker

sourceHugging Faceupdated 11mo agoView on Hugging Face
5likes38downloads
Model Card

๐Ÿ“š Model Card for Grammar Correction Model

This is a grammar correction model based on the Google T5 architecture, fine-tuned on the JHU-CLSP/JFLEG dataset for text correction tasks. โœ๏ธ

Model Details

This model is designed to correct grammatical errors in English sentences. It was fine-tuned using the JFLEG dataset, which provides examples of grammatically correct sentences.

  • โ€”Follow the Developer: Abdul Samad Siddiqui (@samadpls) ๐Ÿ‘จโ€๐Ÿ’ป

Uses

This model can be directly used to correct grammar and spelling mistakes in sentences. โœ…

Example Usage

Here's a basic code snippet to demonstrate how to use the model:

python
import requests

API_URL = "https://api-inference.huggingface.co/models/samadpls/t5-base-grammar-checker"
HEADERS = {"Authorization": "Bearer YOUR_HF_API_KEY"}

def query(payload):
    response = requests.post(API_URL, headers=HEADERS, json=payload)
    return response.json()

data = query({"inputs": "grammar: This sentences, has bads grammar and spelling!"})
print(data)

OR

python
from transformers import T5ForConditionalGeneration, T5Tokenizer

# Load the model and tokenizer
model_name = "samadpls/t5-base-grammar-checker"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)

# Example input
example_1 = "grammar: This sentences, has bads grammar and spelling!"

# Tokenize and generate corrected output
inputs = tokenizer.encode(example_1, return_tensors="pt")
outputs = model.generate(inputs)
corrected_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)

print("Corrected Sentence:", corrected_sentence)

Training Details

The model was trained on the JHU CLSP JFLEG dataset, which includes various examples of sentences with grammatical errors and their corrections. ๐Ÿ“–

Training Procedure

  • โ€”Training Hardware: Personal laptop with NVIDIA GeForce MX230 GDDR5 and 16GB RAM ๐Ÿ’ป
  • โ€”Training Time: Approximately 1 hour โณ
  • โ€”Hyperparameters: No specific hyperparameters were set for training.

Training Logs

StepTraining LossValidation Loss
10.92820.6091
20.61820.5561
30.62790.5345
40.63450.5147
50.56360.5076
60.60090.4928
70.54690.4950
80.57970.4834
90.56190.4818
100.63420.4788
110.54810.4786

Final Training Metrics

  • โ€”Training Runtime: 1508.2528 seconds โฑ๏ธ
  • โ€”Training Samples per Second: 1.799
  • โ€”Training Steps per Second: 0.225
  • โ€”Final Training Loss: 0.5925
  • โ€”Final Epoch: 1.0

Model Card Contact

For inquiries, please contact Abdul Samad Siddiqui via GitHub. ๐Ÿ“ฌ