English Grammar Correction model
Quick Start (Python)
Installation
pip install transformers torch
Basic Usage
from transformers import T5Tokenizer, T5ForConditionalGeneration
import torch
# Load model and tokenizer
model_name = "yoon-eunbin/t5-gec-model"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)
# Set device
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = model.to(device)
# Prepare input
text = "He has left the room when I came into the room."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=64).to(device)
# Generate correction
outputs = model.generate(**inputs, max_length=64)
# Decode output
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"Original: {text}")
print(f"Corrected: {corrected_text}")
- Downloads last month
- 27
Model tree for yoon-eunbin/t5-gec-model
Base model
google-t5/t5-base