Downloads · 30 days
142
4% of all-time downloads
fyaronskiy/ruT5-large-paraphraser
ruT5-large-paraphraser is a text generation model from fyaronskiy. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
This is a model for generation paraphrases for given text.
Downloads · 30 days
142
4% of all-time downloads
All-time downloads
3.4K
Public
Parameters
738M
3 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors3 GB · 100%
From the Hugging Face model README
This is a model for generation paraphrases for given text.
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('Каждый охотник желает знать, где сидит фазан')
# 'Каждый охотник хочет знать о том, где находится фазан.'