Views
No views yet
Note: The API widget has a max length of ~96 tokens due to inference timeout constraints.
bsd-3-clause license. The training process involved 16 epochs with parameters tweaked to facilitate very fine-tuning-type training (super low learning rate).pszemraj/led-base-16384-finetuned-booksum.encoder_no_repeat_ngram_size=3 when calling the pipeline object, as it enhances the summary quality by encouraging the use of new vocabulary and crafting an abstractive summary.1import torch
2from transformers import pipeline
3
4hf_name = "pszemraj/led-base-book-summary"
5
6summarizer = pipeline(
7 "summarization",
8 hf_name,
9 device=0 if torch.cuda.is_available() else -1,
10)1wall_of_text = "your words here"
2
3result = summarizer(
4 wall_of_text,
5 min_length=8,
6 max_length=256,
7 no_repeat_ngram_size=3,
8 encoder_no_repeat_ngram_size=3,
9 repetition_penalty=3.5,
10 num_beams=4,
11 do_sample=False,
12 early_stopping=True,
13)
14print(result[0]["generated_text"])textsum. This package offers simple interfaces for applying summarization models to text documents of arbitrary length.pip install textsum1from textsum.summarize import Summarizer
2
3model_name = "pszemraj/led-base-book-summary"
4summarizer = Summarizer(
5 model_name_or_path=model_name, # you can use any Seq2Seq model on the Hub
6 token_batch_length=4096, # how many tokens to batch summarize at a time
7)
8long_string = "This is a long string of text that will be summarized."
9out_str = summarizer.summarize_string(long_string)
10print(f"summary: {out_str}")