EdinburghNLP/xsum
Viewer • Updated • 227k • 32.3k • 145
How to use Prikshit7766/bart-base-xsum 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="Prikshit7766/bart-base-xsum") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("Prikshit7766/bart-base-xsum")
model = AutoModelForSeq2SeqLM.from_pretrained("Prikshit7766/bart-base-xsum")The model is a sequence-to-sequence transformer based on the BART architecture. It was fine-tuned on the XSum dataset using the facebook/bart-base model, which consists of news articles paired with short summaries.
facebook/bart-base tokenizer.The model was fine-tuned using the Seq2SeqTrainer from the Hugging Face Transformers library with the following training arguments:
predict_with_generate to compute summaries during evaluationrougeLAfter fine-tuning, the model achieved the following scores:
You can easily use the model for summarization tasks using the Hugging Face pipeline. Below is an example:
from transformers import pipeline
# Load the summarization pipeline using the fine-tuned model
summarizer = pipeline("summarization", model="Prikshit7766/bart-base-xsum")
# Input text for summarization
text = (
"In a significant breakthrough in renewable energy, scientists have developed "
"a novel solar panel technology that promises to dramatically reduce costs and "
"increase efficiency. The new panels are lighter, more durable, and easier to install "
"than conventional models, marking a major advancement in sustainable energy solutions. "
"Experts believe this innovation could lead to wider adoption of solar power across residential "
"and commercial sectors, ultimately reducing global reliance on fossil fuels."
)
# Generate summary
summary = summarizer(text)[0]["summary_text"]
print("Generated Summary:", summary)
Example Output:
Generated Summary: Scientists at the University of California, Berkeley, have developed a new type of solar panel.
Base model
facebook/bart-base