|
--- |
|
license: mit |
|
language: |
|
- ru |
|
pipeline_tag: question-answering |
|
tags: |
|
- T5 |
|
- russian |
|
- question-answering |
|
- text-generation |
|
--- |
|
|
|
Модель [ruT5-base](https://huggingface.co./ai-forever/ruT5-base) была fine-tuned для задачи __question answer__, предназначенная для __Russian__ текст. |
|
|
|
## Uses |
|
``` |
|
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) |
|
|
|
prompt='Нарисуй изображение Томаса Шелби' |
|
|
|
def question_answering(prompt): |
|
question = "Что нужно нарисовать?" |
|
tokenized_sentence = qa_tokenizer(prompt, question, return_tensors='pt') |
|
res = qa_model.generate(**tokenized_sentence) |
|
decoded_res = qa_tokenizer.decode(res[0], skip_special_tokens=True) |
|
return decoded_res |
|
|
|
prompt = question_answering(prompt) |
|
# 'изображение Томаса Шелби' |
|
``` |
|
|