How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
# Warning: Pipeline type "summarization" is no longer supported in transformers v5.
# You must load the model directly (see below) or downgrade to v4.x with:
# pip install "transformers<5.0.0"
from transformers import pipeline

pipe = pipeline("summarization", model="IlyaGusev/rut5_base_headline_gen_telegram")
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

tokenizer = AutoTokenizer.from_pretrained("IlyaGusev/rut5_base_headline_gen_telegram")
model = AutoModelForSeq2SeqLM.from_pretrained("IlyaGusev/rut5_base_headline_gen_telegram", device_map="auto")
Quick Links

RuT5TelegramHeadlines

Model description

Based on rut5-base model

Intended uses & limitations

How to use

from transformers import AutoTokenizer, T5ForConditionalGeneration

model_name = "IlyaGusev/rut5_base_headline_gen_telegram"
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
)[0]

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

Training data

Training procedure

Downloads last month
10,573
Inference Providers NEW
Examples

Spaces using IlyaGusev/rut5_base_headline_gen_telegram 3