bart large xsum

Providerfacebook
Categorysummarization
Licensemit
Downloads334
Stars0

Overview

BART-large-xsum is a transformer-based encoder-decoder model specifically fine-tuned on the Extreme Summarization (XSum) dataset. Unlike general-purpose summarizers that extract sentences, this model is optimized for abstractive summarization, meaning it generates concise, single-sentence summaries that capture the core essence of a document rather than just clipping existing text. For developers, this makes it an ideal choice for generating headlines, notification previews, or TL;DR snippets. It integrates seamlessly via the Hugging Face Transformers library, offering a predictable balance between inference speed and linguistic coherence. Compared to larger LLMs, it is significantly more lightweight and specialized, reducing latency and compute costs for dedicated summarization pipelines.

Highlights

  • Specialized in high-quality abstractive, single-sentence summarization
  • Optimized for headline generation and document condensation
  • Easy integration via Hugging Face Transformers library
  • Lightweight alternative to general-purpose large language models
  • Permissive MIT license for flexible commercial deployment

Usage

Install
# Install Hugging Face transformers
pip install transformers torch
SDK Usage
# Load model with transformers
from transformers import AutoModel, AutoTokenizer

model = AutoModel.from_pretrained("facebook/bart-large-xsum")
tokenizer = AutoTokenizer.from_pretrained("facebook/bart-large-xsum")

Hugging Face Download

We recommend downloading the model via the Hugging Face CLI or Hub SDK.

Guidance:Before downloading, install huggingface_hub with:

Guidance
pip install -U huggingface_hub

CLI Download

Download the full repository

Download the full repository
huggingface-cli download facebook/bart-large-xsum

Download a single file to a local folder (e.g. config.json into ./dir)

Download a single file to a local folder (e.g. config.json into ./dir)
huggingface-cli download facebook/bart-large-xsum config.json --local-dir ./dir

See the official docs for more CLI options

SDK Download

SDK Download
# 模型下载
from huggingface_hub import snapshot_download
model_dir = snapshot_download('facebook/bart-large-xsum')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://huggingface.co/facebook/bart-large-xsum

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/facebook/bart-large-xsum

Model files are hosted on the Hugging Face Hub — download directly via HF CLI / SDK / Git, not through this site.

PyTorch / Transformers Usage

Install Transformers

Install Transformers
pip install -U transformers torch

Load the model and run inference

Load the model and run inference
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained('facebook/bart-large-xsum')
tokenizer = AutoTokenizer.from_pretrained('facebook/bart-large-xsum')

Model Download

We recommend downloading the model via the ModelScope CLI or SDK.

Guidance:Before downloading, install ModelScope with:

Guidance
pip install modelscope

CLI Download

Download the full repository

Download the full repository
modelscope download --model facebook/bart-large-xsum

Download a single file to a local folder (e.g. README.md into ./dir)

Download a single file to a local folder (e.g. README.md into ./dir)
modelscope download --model facebook/bart-large-xsum README.md --local_dir ./dir

See the docs for more CLI options

SDK Download

SDK Download
# 模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('facebook/bart-large-xsum')

Git Download

Make sure git-lfs is installed first

Git Download
git lfs install
git clone https://www.modelscope.cn/facebook/bart-large-xsum.git

To skip LFS large-file downloads, use:

Skip LFS
GIT_LFS_SKIP_SMUDGE=1 git clone https://www.modelscope.cn/facebook/bart-large-xsum.git

ModelScope 模型页直接下载模型文件;无需将模型文件放在本站服务器。

Notebook Quickstart

Install the ModelScope library

Install the ModelScope library
pip install "modelscope[audio,cv,nlp,multi-modal,science]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Load the model and run inference

Load the model and run inference
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

p = pipeline('text-generation', 'facebook/bart-large-xsum')

Full Documentation

来源: HuggingFace

---
tags:

  • summarization

language:
  • en

license: mit
model-index:
  • name: facebook/bart-large-xsum

results:
- task:
type: summarization
name: Summarization
dataset:
name: cnn_dailymail
type: cnn_dailymail
config: 3.0.0
split: test
metrics:
- name: ROUGE-1
type: rouge
value: 25.2697
verified: true
- name: ROUGE-2
type: rouge
value: 7.6638
verified: true
- name: ROUGE-L
type: rouge
value: 17.1808
verified: true
- name: ROUGE-LSUM
type: rouge
value: 21.7933
verified: true
- name: loss
type: loss
value: 3.5042972564697266
verified: true
- name: gen_len
type: gen_len
value: 27.4462
verified: true
- task:
type: summarization
name: Summarization
dataset:
name: xsum
type: xsum
config: default
split: test
metrics:
- name: ROUGE-1
type: rouge
value: 45.4525
verified: true
- name: ROUGE-2
type: rouge
value: 22.3455
verified: true
- name: ROUGE-L
type: rouge
value: 37.2302
verified: true
- name: ROUGE-LSUM
type: rouge
value: 37.2323
verified: true
- name: loss
type: loss
value: 2.3128726482391357
verified: true
- name: gen_len
type: gen_len
value: 25.5435
verified: true
- task:
type: summarization
name: Summarization
dataset:
name: samsum
type: samsum
config: samsum
split: train
metrics:
- name: ROUGE-1
type: rouge
value: 24.7852
verified: true
- name: ROUGE-2
type: rouge
value: 5.2533
verified: true
- name: ROUGE-L
type: rouge
value: 18.6792
verified: true
- name: ROUGE-LSUM
type: rouge
value: 20.629
verified: true
- name: loss
type: loss
value: 3.746837854385376
verified: true
- name: gen_len
type: gen_len
value: 23.1206
verified: true
- task:
type: summarization
name: Summarization
dataset:
name: samsum
type: samsum
config: samsum
split: test
metrics:
- name: ROUGE-1
type: rouge
value: 24.9158
verified: true
- name: ROUGE-2
type: rouge
value: 5.5837
verified: true
- name: ROUGE-L
type: rouge
value: 18.8935
verified: true
- name: ROUGE-LSUM
type: rouge
value: 20.76
verified: true
- name: loss
type: loss
value: 3.775235891342163
verified: true
- name: gen_len
type: gen_len
value: 23.0928
verified: true
---

Bart model finetuned on xsum

docs: https://huggingface.co/transformers/model_doc/bart.html

finetuning: examples/seq2seq/ (as of Aug 20, 2020)

Metrics: ROUGE > 22 on xsum.

variants: search for distilbart

paper: https://arxiv.org/abs/1910.13461

Join our Telegram