Instructions to use Jiaao/t5-small-booksum with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jiaao/t5-small-booksum with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "summarization" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("summarization", model="Jiaao/t5-small-booksum")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Jiaao/t5-small-booksum") model = AutoModelForSeq2SeqLM.from_pretrained("Jiaao/t5-small-booksum", device_map="auto") - Notebooks
- Google Colab
- Kaggle
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