Downloads · 30 days
8
4% of all-time downloads
Ponimash/FredInterpreter
FredInterpreter is a machine learning model from Ponimash. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
8
4% of all-time downloads
All-time downloads
180
Public
Parameters
1.7B
7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors7 GB · 100%
From the Hugging Face model README
def qa(doc, q):
doc = doc.replace('\n',' ')
q = q.replace('\n',' ')
q_pr = f'<SC6>Опираясь на информацию: {doc}\n ответь на вопрос: \"{q}\".\n Ответ: '
data_inp = tokenizer(q_pr, return_tensors="pt").to('cuda:0')
return data_inp
def generate(doc, q):
t = qa(doc, q)
output_ids = model.generate(
**t, do_sample=False, temperature=0.0, max_new_tokens=512, repetition_penalty=1, no_repeat_ngram_size=8
)[0]
out = tokenizer.decode(output_ids.tolist(), skip_special_tokens=True)
out = out.replace("<extra_id_0>","")
ans_sqs = sent_tokenize(out, language="russian")
ans = ' '.join(ans_sqs[:3])
return ans.split('Ответ:')[0].split('Вопрос:')[0]