YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

T5 Multi-Style Text Summarizer

A fine-tuned version of google/flan-t5-base capable of generating summaries in three different styles based on desired length and detail: Harsh, Standard, and Detailed. The model uses special style prefixes to control output length.


πŸš€ Model Description

  • Model type: Text-to-Text (T5)
  • Language: English
  • Base model: google/flan-t5-base
  • Task: Controlled text summarization
  • Training datasets: CNN/DailyMail (3.0.0) + XSum
  • Total samples: 5,000
  • Best use case: News-style text summarization

🏷️ Style Prefixes

Prepend one of the following to your input text:

Style Prefix Description
Harsh summarize harsh: Very concise (~30% of original length)
Standard summarize standard: Balanced (~50–60%)
Detailed summarize detailed: More comprehensive (~80%)

πŸ“Œ How to Use (Transformers)

from transformers import T5Tokenizer, T5ForConditionalGeneration

model_name = "Hiratax/t5-base-finetuned-summarizer"  
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)

input_text = """
Russian President Vladimir Putin said that a US plan to end the war in Ukraine could 
β€œform the basis for future agreements” but renewed threats to seize more territory...
"""

# Add style prefix
prefix = "summarize standard: "
inputs = tokenizer(prefix + input_text, return_tensors="pt", max_length=512, truncation=True)

outputs = model.generate(
    inputs["input_ids"],
    max_length=150,
    num_beams=4,
    length_penalty=1.0,
    early_stopping=True
)

summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(summary)

πŸ§ͺ Training Details

  • Epochs: 5
  • Batch size: 4 (Gradient Accumulation = 2)
  • Learning rate: 3e-4
  • Optimizer: AdamW (weight decay 0.01)
  • Max input length: 512 tokens
  • Max target length: 150 tokens

Dataset Labeling Logic

Style was determined based on:

summary_length / original_length
  • Low ratio β†’ Harsh
  • Medium ratio β†’ Standard
  • High ratio β†’ Detailed

⚠️ Limitations

  • Optimized for news-style content.
  • Inputs longer than 512 tokens are truncated.
  • Style control is approximate.
  • Not ideal for creative or conversational text.

πŸ“„ License

Specify your preferred license, e.g.:

Apache 2.0
Downloads last month
2
Safetensors
Model size
0.2B params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support