File size: 1,408 Bytes
c69a1fd
 
66ae9b7
 
 
 
 
c69a1fd
66ae9b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89e379c
66ae9b7
 
 
 
 
 
 
 
a5a9d06
66ae9b7
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
license: mit
language:
- ru
pipeline_tag: text2text-generation
widget:
- text: '<SC6>Человек: Ответь на вопрос. Почему трава зеленая?\nБот: <extra_id_0>'
---
# Den4ikAI/FRED-T5-XL_instructor
Инструкционная модель на FRED-T5-XL.

# Пример использования
```python
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
use_cuda = torch.cuda.is_available()
device = torch.device("cuda" if use_cuda else "cpu")
tokenizer = AutoTokenizer.from_pretrained("Den4ikAI/FRED-T5-XL_instructor")
model = AutoModelForSeq2SeqLM.from_pretrained("Den4ikAI/FRED-T5-XL_instructor", torch_dtype=torch.float16).to(device)
model.eval()

from transformers import GenerationConfig

generation_config = GenerationConfig.from_pretrained("Den4ikAI/FRED-T5-XL_instructor")
def generate(prompt):
  data = tokenizer(f"<SC6>Человек: {prompt}\nБот: <extra_id_0>", return_tensors="pt").to(model.device)
  output_ids = model.generate(
      **data,
      generation_config=generation_config
  )[0]
  out = tokenizer.decode(output_ids.tolist())
  return out

while 1:
  print(generate(input(":> ")))

```
# Citation
```
@MISC{Den4ikAI/FRED-T5-XL_instructor,
    author  = {Denis Petrov},
    title   = {Russian Instructor Model},
    url     = {https://huggingface.co./Den4ikAI/FRED-T5-XL_instructor/},
    year    = 2023
}
```