metadata
library_name: transformers
license: mit
datasets:
- jhu-clsp/jfleg
language:
- en
base_model:
- google-t5/t5-base
pipeline_tag: text2text-generation
π 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:
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
Step | Training Loss | Validation Loss |
---|---|---|
1 | 0.9282 | 0.6091 |
2 | 0.6182 | 0.5561 |
3 | 0.6279 | 0.5345 |
4 | 0.6345 | 0.5147 |
5 | 0.5636 | 0.5076 |
6 | 0.6009 | 0.4928 |
7 | 0.5469 | 0.4950 |
8 | 0.5797 | 0.4834 |
9 | 0.5619 | 0.4818 |
10 | 0.6342 | 0.4788 |
11 | 0.5481 | 0.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. π¬