transformers pytorch safetensors t5 text2text-generation autotrain_compatible text-generation-inference endpoints_compatible region:us
---
{}
---
# news-summarizer

# T5 Base Model Fine-Tuned for News Article Summarization

This repository contains a fine-tuned T5 base model for news article summarization. The model has been trained to generate concise summaries of news articles given their full text.

## Model Details

- Model: T5 Base
- Fine-Tuning Task: News Article Summarization
- Training Data: Dataset of news articles with corresponding summaries
- Tokenizer: T5Tokenizer
- Maximum Input Length: 512 tokens
- Maximum Output Length: 150 tokens
- Beam Search: Enabled (with 4 beams)
- Early Stopping: Enabled

## Usage

To use the fine-tuned T5 model for news article summarization, follow the instructions below:

1. Install the required dependencies:
   pip install transformers torch
2. Load the fine-tuned model:
```python
from transformers import T5Tokenizer, T5ForConditionalGeneration

model_name = 'abhi-pwr/news-summarizer'
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)

3.Generate summaries:
input_text = "Enter the news article here."
inputs = tokenizer.encode(input_text, return_tensors='pt', max_length=512, truncation=True)
summary_ids = model.generate(inputs, max_length=150, num_beams=4, early_stopping=True)
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)


