Downloads · 30 days
1
1% of all-time downloads
tanyamr/rut5-good-news-lora-v5
rut5-good-news-lora-v5 is a text generation model from tanyamr. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapter for Russian news summarization in a calm and positive style. The base model is IlyaGusev/rut5basesumgazeta.
Downloads · 30 days
1
1% of all-time downloads
All-time downloads
77
Public
Repo size
4.4 MB
Likes
0
Public
Click a slice to open those files.
.safetensors3.6 MB · 53%
From the Hugging Face model README
LoRA adapter for Russian news summarization in a calm and positive style. The
base model is IlyaGusev/rut5_base_sum_gazeta.
import torch
from peft import PeftModel
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig
base_model_id = "IlyaGusev/rut5_base_sum_gazeta"
adapter_id = "YOUR_USERNAME/YOUR_MODEL_NAME"
tokenizer = AutoTokenizer.from_pretrained(adapter_id)
base_model = AutoModelForSeq2SeqLM.from_pretrained(base_model_id)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()
generation_config = GenerationConfig.from_pretrained(adapter_id)
prompt = """Суммаризируй новость в стиле добрых новостей. Пиши 2-4 предложения, тёпло и очень оптимистично! Подчеркни помощь, пользу, достижение, поддержку или конструктивное изменение, если это есть в новости. Используй только факты из новости и не добавляй оценок.
Заголовок:
Заголовок новости
Новость:
Текст новости"""
inputs = tokenizer(prompt, return_tensors="pt", max_length=512, truncation=True)
with torch.no_grad():
output_ids = model.generate(
**inputs,
generation_config=generation_config,
)
print(tokenizer.decode(output_ids[0], skip_special_tokens=True))
For reproducible output, use the prompt exactly as shown and load
generation_config.json from this adapter repository. The generation uses beam
search with do_sample=False, so sampling parameters such as temperature and
top_p should not be added.
q, vThe adapter can hallucinate or confuse names, roles, organizations, numbers, locations, sports and event results. Generated summaries must be fact-checked against the source article. The training targets were generated automatically and may contain overly positive or evaluative wording.