SAVRN
Search Contact SAVRN

Open-weight model · Summarization

rut5_base_sum_gazeta

by Ilya Gusev IlyaGusev/rut5_base_sum_gazeta

This is the model for abstractive summarization for Russian based on rut5-base. Source maxlength: 600 Target maxlength: 200 norepeatngramsize: 4 numbeams: 5 Source maxlength: 600 Target maxlength: 200 norepeatngramsize: 4 numbeams: 5

Parameters
Context
Weights977.4 MB
Licenseapache-2.0
AccessOpen weights
Monthly Downloads4.5k

Model Card

By Ilya Gusev, published under apache-2.0, revision f09a08cae5d7.

This is the model for abstractive summarization for Russian based on rut5-base. Source maxlength: 600 Target maxlength: 200 norepeatngramsize: 4 numbeams: 5 Source maxlength: 600 Target maxlength: 200 norepeatngramsize: 4 numbeams: 5

Read Ilya Gusev's full model card

RuT5SumGazeta

Model description

This is the model for abstractive summarization for Russian based on rut5-base.

Intended uses & limitations

How to use

Colab: link

from transformers import AutoTokenizer, T5ForConditionalGeneration

model_name = "IlyaGusev/rut5_base_sum_gazeta"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)

article_text = "..."

input_ids = tokenizer(
    [article_text],
    max_length=600,
    add_special_tokens=True,
    padding="max_length",
    truncation=True,
    return_tensors="pt"
)["input_ids"]

output_ids = model.generate(
    input_ids=input_ids,
    no_repeat_ngram_size=4
)[0]

summary = tokenizer.decode(output_ids, skip_special_tokens=True)
print(summary)

Training data

Training procedure

Eval results

  • Train dataset: Gazeta v1 train
  • Test dataset: Gazeta v1 test
  • Source max_length: 600
  • Target max_length: 200
  • no_repeat_ngram_size: 4
  • num_beams: 5
Model R-1-f R-2-f R-L-f chrF METEOR BLEU Avg char length
mbart_ru_sum_gazeta 32.4 14.3 28.0 39.7 26.4 12.1 371
rut5_base_sum_gazeta 32.2 14.4 28.1 39.8 25.7 12.3 330
rugpt3medium_sum_gazeta 26.2 7.7 21.7 33.8 18.2 4.3 244
  • Train dataset: Gazeta v1 train
  • Test dataset: Gazeta v2 test
  • Source max_length: 600
  • Target max_length: 200
  • no_repeat_ngram_size: 4
  • num_beams: 5
Model R-1-f R-2-f R-L-f chrF METEOR BLEU Avg char length
mbart_ru_sum_gazeta 28.7 11.1 24.4 37.3 22.7 9.4 373
rut5_base_sum_gazeta 28.6 11.1 24.5 37.2 22.0 9.4 331
rugpt3medium_sum_gazeta 24.1 6.5 19.8 32.1 16.3 3.6 242

Predicting all summaries:

import json
import torch
from transformers import AutoTokenizer, T5ForConditionalGeneration
from datasets import load_dataset


def gen_batch(inputs, batch_size):
    batch_start = 0
    while batch_start < len(inputs):
        yield inputs[batch_start: batch_start + batch_size]
        batch_start += batch_size


def predict(
    model_name,
    input_records,
    output_file,
    max_source_tokens_count=600,
    batch_size=8
):
    device = "cuda" if torch.cuda.is_available() else "cpu"

    tokenizer = AutoTokenizer.from_pretrained(model_name)
    model = T5ForConditionalGeneration.from_pretrained(model_name).to(device)

    predictions = []
    for batch in gen_batch(input_records, batch_size):
        texts = [r["text"] for r in batch]
        input_ids = tokenizer(
            texts,                                                                                                     
            add_special_tokens=True,
            max_length=max_source_tokens_count,
            padding="max_length",
            truncation=True,
            return_tensors="pt"
        )["input_ids"].to(device)

        output_ids = model.generate(
            input_ids=input_ids,
            no_repeat_ngram_size=4
        )
        summaries = tokenizer.batch_decode(output_ids, skip_special_tokens=True)
        for s in summaries:
            print(s)
        predictions.extend(summaries)
    with open(output_file, "w") as w:
        for p in predictions:
            w.write(p.strip().replace("\n", " ") + "\n")

gazeta_test = load_dataset('IlyaGusev/gazeta', script_version="v1.0")["test"]
predict("IlyaGusev/rut5_base_sum_gazeta", list(gazeta_test), "t5_predictions.txt")

Evaluation script: evaluate.py

Flags: --language ru --tokenize-after --lower

Configuration

Architecture
T5ForConditionalGeneration
Vocabulary size
30,000
Stored precision
float32
Model type
t5

Identity and Version

Repository
IlyaGusev/rut5_base_sum_gazeta
Publisher
Ilya Gusev
Task
Summarization
Modality
Text
Library
transformers
Parameters
Not stated by the source
Languages
ru
Revision
f09a08cae5d74c70e55da1a6ebb49f88c26f433b
First published
2022-03-02
Last updated
2022-07-13

Files and Weights

8 files, 979.5 MB in total. The weights are 1 file totalling 977.4 MB in bin.

Weights1 file · 977.4 MB
Configuration2 files · 831 B
Tokenizer3 files · 2.1 MB
Documentation1 file · 14.3 KB
Repository1 file · 1.3 KB
Every file
FileTypeSizeSHA-256
pytorch_model.binWeights977.4 MB f246aacded64
config.jsonConfiguration766 B
special_tokens_map.jsonConfiguration65 B
README.mdDocumentation14.3 KB
.gitattributesRepository1.3 KB
spiece.modelTokenizer827.6 KB 76927654c70c
tokenizer.jsonTokenizer1.3 MB cdb7debb2b2f
tokenizer_config.jsonTokenizer279 B

License and Download

License
apache-2.0
Access
Open weights, no gate
Download size
977.4 MB
Download from Ilya Gusev

Released by Ilya Gusev through its official repository on Hugging Face. Read the license.

Built From

  • Trained on (disclosed) IlyaGusev/gazeta

Memory Requirements

PrecisionWeights in memory
As published977.4 MB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About rut5_base_sum_gazeta

Can I use rut5_base_sum_gazeta commercially?

Yes. rut5_base_sum_gazeta is released under Apache License 2.0. The Apache License 2.0 is a permissive open-source license. It permits commercial use, modification and redistribution. It requires keeping the license and copyright notices and any NOTICE file, stating significant changes, and it includes an express patent grant from contributors.

Similar Models

Model · Summarization

distilbart-cnn-12-6

Sam Shleifer

This checkpoint should be loaded into BartForConditionalGeneration.frompretrained. See the BART docs for more information.

Open weights apache-2.0 1,024 tokens transformers

Model · Summarization

pegasus-xsum

Google

Original TF 1 code here Authors: Jingqing Zhang, Yao Zhao, Mohammad Saleh and Peter J. Liu on Dec 18, 2019 The following is copied from the authors' README. We train a pegasus model with sampled gap sentence ratios on both C4 and HugeNews, and stochastically sample important sentences. The updated the results are reported in this table. The "Mixed & Stochastic" model has the following changes: - trained on both C4 and HugeNews (dataset mixture is weighted by their number of examples). - trained for 1.5M instead of 500k (we observe slower convergence on pretraining perplexity). - the model uniformly sample a gap sentence ratio between 15% and 45%. - importance sentences are sampled using a…

Open weights 512 tokens transformers

Model · Summarization

distilbart-xsum-12-6

Sam Shleifer

This checkpoint should be loaded into BartForConditionalGeneration.frompretrained. See the BART docs for more information.

Open weights apache-2.0 1,024 tokens transformers

This repository contains the mT5 checkpoint finetuned on the 45 languages of XL-Sum dataset. For finetuning details and scripts, see the paper and the official repository. Scores on the XL-Sum test sets are as follows: Language | ROUGE-1 / ROUGE-2 / ROUGE-L Amharic | 20.0485 / 7.4111 / 18.0753 Arabic | 34.9107 / 14.7937 / 29.1623 Azerbaijani | 21.4227 / 9.5214 / 19.3331 Bengali | 29.5653 / 12.1095 / 25.1315 Burmese | 15.9626 / 5.1477 / 14.1819 Chinese (Simplified) | 39.4071 / 17.7913 / 33.406 Chinese (Traditional) | 37.1866 / 17.1432 / 31.6184 English | 37.601 / 15.1536 / 29.8817 French | 35.3398 / 16.1739 / 28.2041 Gujarati | 21.9619 / 7.7417 / 19.86 Hausa | 39.4375 / 17.6786 / 31.6667…

Open weights transformers