Downloads · 30 days
17
19% of all-time downloads
ciorant/news-summarizer
news-summarizer is a summarization model from ciorant. Use it when you need a shorter version of a longer text. The card lists the license as apache-2.0.
This model is fine-tuned for news article summarization. It can take long news articles and generate concise, accurate summaries.
Downloads · 30 days
17
19% of all-time downloads
All-time downloads
88
Public
Parameters
406M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.6 GB · 100%
From the Hugging Face model README
This model is fine-tuned for news article summarization. It can take long news articles and generate concise, accurate summaries.
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
import re
# Load model
model = AutoModelForSeq2SeqLM.from_pretrained("ciorant/news-summarizer")
tokenizer = AutoTokenizer.from_pretrained("ciorant/news-summarizer")
def summarize_news(article_text, max_length=128):
inputs = tokenizer(article_text, return_tensors="pt", truncation=True, max_length=512)
outputs = model.generate(
inputs.input_ids,
max_length=max_length,
num_beams=4,
early_stopping=True,
do_sample=False,
length_penalty=1.0
)
summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
# Clean up spacing around punctuation
summary = re.sub(r'\s+([.,!?;:])', r'\1', summary)
summary = re.sub(r'\s+', ' ', summary)
return summary.strip()
# Example usage
article = "Your news article text here..."
summary = summarize_news(article)
print(summary)
Trained on news articles for summarization task.