Views
No views yet
1summarizer = pipeline("summarization",
2 model = "NotXia/pubmedbert-bio-ext-summ",
3 tokenizer = AutoTokenizer.from_pretrained("NotXia/pubmedbert-bio-ext-summ"),
4 trust_remote_code = True,
5 device = 0
6)
7
8sentences = ["sent1.", "sent2.", "sent3?"]
9summarizer({"sentences": sentences}, strategy="count", strategy_args=2)
10>>> (['sent1.', 'sent2.'], [0, 1])length: summary with a maximum length (strategy_args is the maximum length).count: summary with the given number of sentences (strategy_args is the number of sentences).ratio: summary proportional to the length of the document (strategy_args is the ratio [0, 1]).threshold: summary only with sentences with a score higher than a given value (strategy_args is the minimum score).