t5-small-samsum-summarizer
T5-small fine-tuned on a subset of the SAMSum dataset (4,000 training and 500 validation examples, 6 epochs) for chat dialogue summarization.
Usage
from transformers import T5ForConditionalGeneration, T5Tokenizer
model = T5ForConditionalGeneration.from_pretrained("IsaacNaveed/t5-small-samsum-summarizer")
tokenizer = T5Tokenizer.from_pretrained("IsaacNaveed/t5-small-samsum-summarizer")
text = "amanda: i baked cookies. do you want some? jerry: sure! amanda: i'll bring you some tomorrow :)"
inputs = tokenizer(text, return_tensors="pt", max_length=512, truncation=True)
ids = model.generate(**inputs, max_length=150, num_beams=4, early_stopping=True)
print(tokenizer.decode(ids[0], skip_special_tokens=True))
Notes
- Input should be lowercase, chat-style dialogue like SAMSum.
- Trained on a small subset, so summaries may contain errors.
- The SAMSum dataset has its own license (CC BY-NC-ND 4.0), which applies to the training data.
- Source code: https://github.com/Isaac-Naveed/Text-Summarizer-Using-HuggingFace-T5Model