abisee/cnn_dailymail
Viewer β’ Updated β’ 936k β’ 131k β’ 343
How to use haydarkadioglu/bart-base-cnn-finetuned 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="haydarkadioglu/bart-base-cnn-finetuned") # Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("haydarkadioglu/bart-base-cnn-finetuned")
model = AutoModelForSeq2SeqLM.from_pretrained("haydarkadioglu/bart-base-cnn-finetuned")This project contains a fine-tuned version of BART-base for abstractive text summarization using the CNN/DailyMail dataset.
pip install transformers datasets torch
bart_base_fine_tuned_cnn.ipynb β Jupyter notebook used for fine-tuning pytorch_model.bin, config.json, tokenizer.json, etc.)After uploading the model to the Hugging Face Hub, you can use it like this:
from transformers import BartForConditionalGeneration, BartTokenizer
model_name = "haydarkadioglu/bart-base-cnn-finetuned" # replace with your repo name
tokenizer = BartTokenizer.from_pretrained(model_name)
model = BartForConditionalGeneration.from_pretrained(model_name)
text = "The US president gave a speech today about..."
inputs = tokenizer([text], return_tensors="pt", max_length=1024, truncation=True)
summary_ids = model.generate(
inputs["input_ids"],
num_beams=4,
max_length=150,
early_stopping=True
)
print(tokenizer.decode(summary_ids[0], skip_special_tokens=True))
cnn_dailymail from Hugging Face)transformersdatasetstorchInput (news article):
The heatwave affecting different regions of Turkey continues to negatively impact daily life. According to a statement by the General Directorate of Meteorology, air temperatures are expected to remain 6 to 10 degrees above seasonal norms throughout the coming week. Especially the elderly, children, and people with chronic illnesses are advised not to go outside between 11:00 AM and 4:00 PM, when the sun is at its strongest. Meanwhile, municipalities have started taking various measures to create cool areas for citizens. While misting systems are being installed in parks and gardens, air-conditioned resting areas have also been made available in some regions.
Generated Summary:
The heatwave affecting different regions of Turkey continues to negatively impact daily life .
The heat is expected to remain 6 to 10 degrees above seasonal norms throughout the coming week .
Municipalities have started taking various measures to create cool areas for citizens .
This project is intended for research and educational purposes.
Base model
facebook/bart-base