T5 Small BookSum

A T5-small model fine-tuned for book summarization tasks.

Description

This model is a T5-small architecture that has been fine-tuned on the BookSum dataset for abstractive summarization of book chapters and stories. The model takes long-form text input and generates concise summaries that capture the main points and narrative elements.

Intended use

This model is intended for:

  • Generating summaries of book chapters and literary texts
  • Educational applications for reading comprehension
  • Research on long-form text summarization
  • Building applications that require understanding of narrative structure

The model should be used with the prefix "summarize: " before the input text.

Limitations

  • The model may struggle with very long inputs beyond its training distribution
  • Summaries may occasionally miss subtle narrative elements or character developments
  • Performance may vary across different literary genres and writing styles
  • The model is trained primarily on English texts and may not perform well on other languages
  • Generated summaries may contain factual inconsistencies with the source text

How to use

from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

model = AutoModelForSeq2SeqLM.from_pretrained("cnicu/t5-small-booksum")
tokenizer = AutoTokenizer.from_pretrained("cnicu/t5-small-booksum")

text = "Your long book chapter text here..."
input_text = "summarize: " + text
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True)

summary_ids = model.generate(
    inputs["input_ids"],
    max_length=200,
    min_length=30,
    num_beams=4,
    early_stopping=True,
    no_repeat_ngram_size=3,
    length_penalty=2.0
)

summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
print(summary)
Downloads last month
5
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support