Downloads · 30 days
17
15% of all-time downloads
Jiaao/t5-small-booksum
t5-small-booksum is a summarization model from Jiaao. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as apache-2.0.
A T5-small model fine-tuned for book summarization tasks.
Downloads · 30 days
17
15% of all-time downloads
All-time downloads
112
Public
Repo size
40 KB
Likes
0
Public
Click a slice to open those files.
.bin40 KB · 91%
From the Hugging Face model README
A T5-small model fine-tuned for book summarization tasks.
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.
This model is intended for:
The model should be used with the prefix "summarize: " before the input text.
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)