Downloads · 30 days
143
3% of all-time downloads
Den4ikAI/FRED-T5-LARGE_text_qa
FRED-T5-LARGE_text_qa is a text generation model from Den4ikAI. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Модель обучена отвечать на вопросы с помощью текста.
Downloads · 30 days
143
3% of all-time downloads
All-time downloads
5.1K
Public
Parameters
820M
3.3 GB on disk
Likes
5
Public
Click a slice to open those files.
.bin1.6 GB · 50%
From the Hugging Face model README
Модель обучена отвечать на вопросы с помощью текста.
Wandb: link
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
from transformers import GenerationConfig
use_cuda = torch.cuda.is_available()
device = torch.device("cuda" if use_cuda else "cpu")
generation_config = GenerationConfig.from_pretrained("Den4ikAI/FRED-T5-LARGE_text_qa")
tokenizer = AutoTokenizer.from_pretrained("Den4ikAI/FRED-T5-LARGE_text_qa")
model = AutoModelForSeq2SeqLM.from_pretrained("Den4ikAI/FRED-T5-LARGE_text_qa").to(device)
model.eval()
def generate(prompt):
data = tokenizer(f"{prompt}", return_tensors="pt").to(model.device)
output_ids = model.generate(
**data,
generation_config=generation_config
)[0]
print(tokenizer.decode(data["input_ids"][0].tolist()))
out = tokenizer.decode(output_ids.tolist())
return out
while 1:
prompt = '''<SC6>Текст: {}\nВопрос: {}\nОтвет: <extra_id_0>
'''.format(input('Текст: '), input('Вопрос: '))
print(generate(prompt))