Downloads · 30 days
16
23% of all-time downloads
yoon-eunbin/t5-gec-model
t5-gec-model is a text generation model from yoon-eunbin. Use it when you need the model to write or continue text.
from transformers import T5Tokenizer, T5ForConditionalGeneration import torch
Downloads · 30 days
16
23% of all-time downloads
All-time downloads
69
Public
Parameters
223M
892 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors892 MB · 100%
From the Hugging Face model README
pip install transformers torch
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}")