Model Card for grammar-t5-small

This is a finetuned model based on flan-t5-small, for English grammar fixing.

Demo

from transformers import T5Tokenizer, T5ForConditionalGeneration

# Load model and tokenizer
tokenizer = T5Tokenizer.from_pretrained("huytd189/grammar-t5-small")
model = T5ForConditionalGeneration.from_pretrained("huytd189/grammar-t5-small")

input_texts = [
    "Rewrite and fix: 'I will drank two bottle'",
    "Rewrite and fix: 'She go to the store'",
    "Rewrite and fix: 'He is more taller than me'"
]

for input_text in input_texts:
    # Tokenize input
    input_ids = tokenizer(input_text, return_tensors="pt").input_ids

    # Generate with better parameters
    outputs = model.generate(
        input_ids,
        max_length=50,
        num_beams=4,
        early_stopping=True
    )

    # Decode output
    result = tokenizer.decode(outputs[0], skip_special_tokens=True)
    print(f"Input: {input_text}")
    print(f"Output: {result}\n")

Base flan-t5-small output:

Input: Rewrite and fix: 'I will drank two bottle'
Output: I will drank two bottle

Input: Rewrite and fix: 'She go to the store'
Output: She go to the store

Input: Rewrite and fix: 'He is more taller than me'
Output: He is more taller than me

Finetuned grammar-t5-small output:

Input: Rewrite and fix: 'I will drank two bottle'
Output: 'I will drink two bottles'

Input: Rewrite and fix: 'She go to the store'
Output: 'She goes to the store'

Input: Rewrite and fix: 'He is more taller than me'
Output: 'He's more taller than me'
Downloads last month
126
Safetensors
Model size
77M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for huytd189/grammar-t5-small

Finetuned
(432)
this model

Dataset used to train huytd189/grammar-t5-small