haydarkadioglu's picture
Update README.md
e083fa5 verified
metadata
library_name: transformers
tags:
  - code
datasets:
  - abisee/cnn_dailymail
language:
  - en
base_model:
  - facebook/bart-base
pipeline_tag: summarization

Fine-Tuned BART (CNN/DailyMail)

This project contains a fine-tuned version of BART-base for abstractive text summarization using the CNN/DailyMail dataset.

Run with Google Colab

pip install transformers datasets torch

πŸ“Œ Contents

  • bart_base_fine_tuned_cnn.ipynb β†’ Jupyter notebook used for fine-tuning
  • Fine-tuned model files (pytorch_model.bin, config.json, tokenizer.json, etc.)

πŸš€ Usage

1. Load from Hugging Face

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))
  • Run the cells step by step to fine-tune or test the model.

πŸ“Š Training Details

  • Base Model: BART-base
  • Dataset: CNN/DailyMail (cnn_dailymail from Hugging Face)
  • Task: Abstractive Summarization
  • Evaluation Metric: ROUGE-1, ROUGE-2, ROUGE-L

πŸ“¦ Requirements

  • Python 3.8+
  • transformers
  • datasets
  • torch

✨ Example Output

Input (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 .

πŸ“œ License

This project is intended for research and educational purposes.