Instructions to use facebook/bart-large-cnn with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use facebook/bart-large-cnn 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="facebook/bart-large-cnn")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("facebook/bart-large-cnn") model = AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large-cnn") - Inference
- Notebooks
- Google Colab
- Kaggle
Strange last sentence after summarization
Hi,
The model works very well, but every time I am using it, the summary ends with : "For more information, visit acompany.com/S synchronous-reluctant-machines or call 1-800-847-8255. For confidential support, call the Samaritans on 08457 90 90 90, visit a local Samaritans branch or see www.samaritans.org for details."
Anyone is having the same issue?
Thanks,
David
I am receiving the message as "For more information visit https://www.govtjobs.co.in " strange it is.
Yes, got that anywhere. Maybe need to filter out some text.
It's happening to me as well. In my case I'm getting something like:
Please email your story to jennifer.smith@mailonline.co.uk. For confidential support call the Samaritans on 08457 90 90 90 or visit a local Samaritans branch, see www.samaritans.org for details.
I find that this happens when the length of the text you're trying to summarize is less than the expected min_length of the response. So in order to compensate for the lack of words, bart starts hallucinating.