This is a model for generation paraphrases for given text.

Usage

Using model with Huggingface Transformers:

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model_name = "fyaronskiy/ruT5-large-paraphraser"
model = AutoModelForSeq2SeqLM.from_pretrained(model_name).to(device)
tokenizer = AutoTokenizer.from_pretrained(model_name)

def paraphrase(text, beams=5, grams=3, **kwargs):
    x = tokenizer(text, return_tensors='pt', padding=True).to(device)
    max_size = int(x.input_ids.shape[1] * 1.5)
    output = model.generate(**x, encoder_no_repeat_ngram_size=grams, num_beams=beams, \
                         max_length=max_size, do_sample = True,  **kwargs)
    
    return tokenizer.decode(output[0], skip_special_tokens=True)

paraphrase('Для оценки ситуации в данной сфере эксперты РИА Новости рассчитали соотношение среднедушевых доходов в регионах России и стоимости фиксированного набора потребительских товаров и услуг. Этот показатель позволяет сравнивать регионы по уровню доходов с учетом их покупательной способности, во многом зависящей от уровня местных цен.')
# 'Эксперты РИА Новости оценили среднедушевые доходы россиян и стоимость фиксированной потребительской корзины, а также ее покупательную способность, которая во многом зависит от уровня цен в регионе.'

paraphrase('Каждый охотник желает знать, где сидит фазан')
# 'Каждый охотник хочет знать о том, где находится фазан.'
Downloads last month
136
Safetensors
Model size
738M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported third-party Inference Providers, and the model is not deployed on the HF Inference API.

Model tree for fyaronskiy/ruT5-large-paraphraser

Adapter
(2)
this model

Dataset used to train fyaronskiy/ruT5-large-paraphraser

Collection including fyaronskiy/ruT5-large-paraphraser