Downloads · 30 days
29
1% of all-time downloads
r1char9/ruT5_q_a
ruT5_q_a is a question answering model from r1char9. Use it when the input is a question plus a passage. It is set up for transformers. The card lists the license as mit.
A fine-tuned version of ai-forever/ruT5-base for the question answering task in Russian.
Downloads · 30 days
29
1% of all-time downloads
All-time downloads
2.6K
Public
Parameters
238M
951 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors951 MB · 100%
From the Hugging Face model README
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.
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)
# 'изображение Томаса Шелби'
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.