Views
No views yet
pip install datasets transformers evaluate1from transformers import T5Tokenizer, T5ForConditionalGeneration
2
3model_name = "t5-base"
4tokenizer = T5Tokenizer.from_pretrained(model_name)
5model = T5ForConditionalGeneration.from_pretrained("path/to/your/fine-tuned-model")
6
7def correct_grammar(text, max_length=128):
8 input_text = "fix: " + text
9 inputs = tokenizer(input_text, return_tensors="pt", truncation=True, padding=True).to(model.device)
10 output_ids = model.generate(inputs['input_ids'], max_length=max_length)
11 return tokenizer.decode(output_ids[0], skip_special_tokens=True)epocht5-base.
├── config.json
├── tokenizer_config.json
├── special_tokens_map.json
├── tokenizer.json
├── model.safetensors # Fine-Tuned Model
├── README.md # Model documentation