suriya7's picture
Update README.md
486dcb3 verified
|
raw
history blame
1.6 kB
metadata
license: mit
datasets:
  - EdinburghNLP/xsum
pipeline_tag: summarization

BART Large CNN Text Summarization Model

This model is based on the Facebook BART (Bidirectional and Auto-Regressive Transformers) architecture, specifically the large variant fine-tuned for text summarization tasks. BART is a sequence-to-sequence model introduced by Facebook AI, capable of handling various natural language processing tasks, including summarization.

Model Details:

  • Architecture: BART Large CNN
  • Pre-trained model: BART Large
  • Fine-tuned for: Text Summarization
  • Fine-tuning dataset: [xsum]

Usage:

Installation:

You can install the necessary libraries using pip:

  pip install transformers
  pip datasets
  pip evaluate
  pip rouge_score

## Example Usage

Here's an example of how to use this model for text summarization:

```python
# Load model and tokenizer
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("your_model_name")
model = AutoModelForSeq2SeqLM.from_pretrained("your_model_name")

# Input text to be summarized
text_to_summarize = "Insert your text to summarize here..."

# Generate summary
inputs = tokenizer([text_to_summarize], max_length=1024, return_tensors='pt', truncation=True)
summary_ids = model.generate(inputs['input_ids'], max_length=100, num_beams=4, early_stopping=True)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)

# Print the generated summary
print("Input Text:")
print(text_to_summarize)
print("\nGenerated Summary:")
print(summary)