Downloads · 30 days
48
0% of all-time downloads
dmitry-vorobiev/rubert_ria_headlines
rubert_ria_headlines is a summarization model from dmitry-vorobiev. Use it when you need a shorter version of a longer text. It is set up for transformers. The card lists the license as mit.
bert2bert model, initialized with the DeepPavlov/rubert-base-cased pretrained weights and fine-tuned on the first 99% of "Rossiya Segodnya" news dataset for 2 epochs.
Downloads · 30 days
48
0% of all-time downloads
All-time downloads
12.1K
Public
Parameters
207M
4.1 GB on disk
Likes
2
Public
Click a slice to open those files.
.bin828 MB · 50%
How the weights are stored.
F32207M · 100%
From the Hugging Face model README
bert2bert model, initialized with the DeepPavlov/rubert-base-cased pretrained weights and
fine-tuned on the first 99% of "Rossiya Segodnya" news dataset for 2 epochs.
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
MODEL_NAME = "dmitry-vorobiev/rubert_ria_headlines"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForSeq2SeqLM.from_pretrained(MODEL_NAME)
text = "Скопируйте текст статьи / новости"
encoded_batch = tokenizer.prepare_seq2seq_batch(
[text],
return_tensors="pt",
padding="max_length",
truncation=True,
max_length=512)
output_ids = model.generate(
input_ids=encoded_batch["input_ids"],
max_length=36,
no_repeat_ngram_size=3,
num_beams=5,
top_k=0
)
headline = tokenizer.decode(output_ids[0],
skip_special_tokens=True,
clean_up_tokenization_spaces=False)
print(headline)
I used free TPUv3 on kaggle. The model was trained for 3 epochs with effective batch size 192 and soft restarts (warmup steps 1500 / 500 / 500 with new optimizer state on each epoch start).
Common train params:
export XLA_USE_BF16=1
export XLA_TENSOR_ALLOCATOR_MAXSIZE=100000000
python nlp_headline_rus/src/train_seq2seq.py \
--do_train \
--tie_encoder_decoder \
--max_source_length 512 \
--max_target_length 32 \
--val_max_target_length 48 \
--tpu_num_cores 8 \
--per_device_train_batch_size 24 \
--gradient_accumulation_steps 1 \
--learning_rate 5e-4 \
--adam_epsilon 1e-6 \
--weight_decay 1e-5 \