Summarization
Transformers
PyTorch
TensorFlow
JAX
Rust
Safetensors
English
bart
text2text-generation
Eval Results (legacy)
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
Error while summarizing
#61
by Harsh6519 - opened
I still receive the same error despite setting truncation to True and max_length to 200. Error message states that 'Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.'
but I clearly set max_length: summary = summarizer(text_to_summarize, min_length=10, max_length=200, truncation=True)
The maximum input length for bart is 1024 tokens. To not have the error, do the following:
summarizer.tokenizer.model_max_length = 1024
summarizer(long_text, max_new_tokens=10, truncation=True, min_length=1)
The max output length is also 1024
