How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("question-answering", model="r1char9/ruT5_q_a")
# Load model directly
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

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

ruT5_q_a

A fine-tuned version of ai-forever/ruT5-base for the question answering task in Russian.

The model takes a text (context) and a question about it as input, and generates an answer extracted or paraphrased from the context.

Usage

from transformers import AutoTokenizer, T5ForConditionalGeneration

qa_checkpoint = "r1char9/ruT5_q_a"
qa_model = T5ForConditionalGeneration.from_pretrained(qa_checkpoint)
qa_tokenizer = AutoTokenizer.from_pretrained(qa_checkpoint)


def question_answering(context, question):
    tokenized = qa_tokenizer(context, question, return_tensors="pt")
    output = qa_model.generate(**tokenized)
    return qa_tokenizer.decode(output[0], skip_special_tokens=True)


context = "Нарисуй изображение Томаса Шелби"
question = "Что нужно нарисовать?"

answer = question_answering(context, question)

# 'изображение Томаса Шелби'

Input format

The model expects a (context, question) pair, passed to the tokenizer as two positional arguments — tokenizer(context, question, ...). The tokenizer combines them into a single sequence using T5's own separator scheme.

Limitations

  • Answer quality directly depends on how well the question relates to the provided context; questions with no answer present in the context may lead to undefined or nonsensical generations.
  • The model has no access to external knowledge — it only works with the context passed as input (extractive/abstractive QA over the given context, not knowledge-based QA).
Downloads last month
23
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for r1char9/ruT5_q_a

Finetuned
(24)
this model

Collection including r1char9/ruT5_q_a