Is there a Python library that supports abstractive summarization? (Excluding cloud-based models like GPT or ChatGPT). We can perform extractive summarization easily using the code below:

!pip3 install transformers==4.11.3
!pip3 install summarizer
!pip3 install bert-extractive-summarizer
!pip3 install keybert
!pip3 install keybert[flair]
!pip3 install keybert[gensim]
!pip3 install keybert[spacy]
!pip3 install keybert[use]
!pip3 install spacy
!pip3 install "gensim==3.8.3"

from summarizer import Summarizer,TransformerSummarizer
GPT2_model = TransformerSummarizer(transformer_type="GPT2",transformer_model_key="gpt2-medium")
GPT2_summary = ''.join(GPT2_model(body, ratio=0.1))

1 Answer 1


HuggingFace T5 can perform abstractive summarization. There's a really good tutorial here: https://huggingface.co/docs/transformers/tasks/summarization which includes finetuning, but this is optional.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.