samadpls/t5-base-grammar-checker
538
๐ 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:
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
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
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. ๐ฌ
