Downloads · 30 days
57
5% of all-time downloads
data-silence/any-news-sum
any-news-sum is a summarization model from data-silence. Use it when you need a shorter version of a longer text. It is set up for transformers.
This repository contains the mT5 checkpoint finetuned on the 45 languages of my sumnews dataset which based on popular XL-Sum. The model solves the news summarization task: it's designed to simultaneously generate a h…
Downloads · 30 days
57
5% of all-time downloads
All-time downloads
1.2K
Public
Parameters
582M
97.9 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors2.3 GB · 99%
From the Hugging Face model README
This repository contains the mT5 checkpoint finetuned on the 45 languages of my sumnews dataset which based on popular XL-Sum. The model solves the news summarization task: it's designed to simultaneously generate a headline and a summary of a news article based on its full content. The primary focus of the training was on Russian language operation, but to some extent the model will work on text in any language supported by the mT5 mother model and XL-Sum dataset.
SpacesYou can try out the trained model here
transformersimport torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, DataCollatorForSeq2Seq
# Загрузка модели и токенизатора
model_name = "data-silence/any-news-sum"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def generate_summary_with_special_tokens(text, max_length=512):
inputs = tokenizer(text, return_tensors="pt", max_length=max_length, truncation=True).to(device)
outputs = model.generate(
**inputs,
max_length=max_length,
num_return_sequences=1,
no_repeat_ngram_size=4,
)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=False)
# Разделение на заголовок и резюме
parts = generated_text.split('<title_resume_sep>')
title = parts[0].replace("<pad> ", "").strip()
resume = parts[1].replace("</s>", "").strip() if len(parts) > 1 else ""
return title, resume
title, resume = generate_summary_with_special_tokens('Пациенты с сердечными заболеваниями зачастую имеют низкий уровень мелатонина и нарушение цикла сна-бодрствования. До сих пор механизмы, лежащие в основе этого явления, оставались неясными. В статье, опубликованной в журнале Science, команда Мюнхенского технического университета (TUM) показывает, каким именно образом сердечные заболевания влияют на выработку гормона сна в шишковидной железе. А в качестве связующего звена между двумя органами оказывается ганглий в области шеи.')
print(title) # Ученые показал, каким именно образом сердечные заболевания влияют на выработку гормона сна в шишковидной железе
print(resume) # Ученые опубликовали статью, опубликованную в журнале Science, команда Мюнхенского технического университета (TUM) показывает, каким образом кардиальные заболевания влияет на выработку гормона сна в шишковидной железе.
The following hyperparameters were used during training:
This model achieves the following results on the evaluation set:
| Metric | Significance | ROUGE-1 | ROUGE-2 | ROUGE-L |
|---|---|---|---|---|
| Training Loss | 0.4487 | - | - | - |
| Epoch | 4.0 | - | - | - |
| Step | 20496 | - | - | - |
| Evaluation Runtime (s) | 3433.4702 | - | - | - |
| Evaluation Samples/Sec | 9.37 | - | - | - |
| Evaluation Steps/Sec | 1.562 | - | - | - |
| Evaluation Loss | 0.2748 | - | - | - |
| Evaluation Title | - | 0.1373 | 0.0489 | 0.1220 |
| Evaluation Resume | - | 0.0016 | 0.0005 | 0.0015 |
| """ |