--- datasets: - grammarly/coedit - Owishiboo/grammar-correction language: - en base_model: - google-t5/t5-base pipeline_tag: text-generation --- # English Grammar Correction model # Quick Start (Python) ### Installation ```bash pip install transformers torch ``` ### Basic Usage ```python 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}")