File size: 1,997 Bytes
e50b7bd 3b57212 f592f82 12d6d6a 6ec6737 cf22a47 12d6d6a eb00670 12d6d6a eb00670 12d6d6a eb00670 12d6d6a 1347fb5 12d6d6a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
---
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:
```bash
pip install transformers
pip datasets
pip evaluate
pip rouge_score
### Inference
```bash
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("suriya7/text_summarize")
model = AutoModelForSeq2SeqLM.from_pretrained("suriya7/text_summarize")
def generate_summary(text):
inputs = tokenizer([text], max_length=1024, return_tensors='pt', truncation=True)
summary_ids = model.generate(inputs['input_ids'],max_new_tokens=100, do_sample=False)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
return summary
text_to_summarize = "Now, there is no doubt that one of the most important aspects of any Pixel phone is its camera.
And there might be good news for all camera lovers. Rumours have suggested that the Pixel 9 could come with a telephoto lens,
improving its photography capabilities even further. Google will likely continue to focus on using AI to
enhance its camera performance, in order to make sure that Pixel phones remain top contenders in the world of mobile photography"
summary = generate_summary(text_to_summarize) |