Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,47 @@
|
|
1 |
---
|
2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
+
language:
|
4 |
+
- ru
|
5 |
+
pipeline_tag: text2text-generation
|
6 |
+
widget:
|
7 |
+
- text: '<SC6>Человек: Ответь на вопрос. Почему трава зеленая?\nБот: <extra_id_0>'
|
8 |
---
|
9 |
+
# Den4ikAI/FRED-T5-XL_instructor
|
10 |
+
Инструкционная модель на FRED-T5-XL.
|
11 |
+
|
12 |
+
# Пример использования
|
13 |
+
```python
|
14 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
15 |
+
import torch
|
16 |
+
use_cuda = torch.cuda.is_available()
|
17 |
+
device = torch.device("cuda" if use_cuda else "cpu")
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained("Den4ikAI/FRED-T5-XL_instructor")
|
19 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("Den4ikAI/FRED-T5-XL_instructor", torch_dtype=torch.float16).to(device)
|
20 |
+
model.eval()
|
21 |
+
|
22 |
+
from transformers import GenerationConfig
|
23 |
+
|
24 |
+
generation_config = GenerationConfig.from_pretrained("Den4ikAI/FRED-T5-XL_instructor")
|
25 |
+
def generate(prompt):
|
26 |
+
data = tokenizer(sample, return_tensors="pt").to(model.device)
|
27 |
+
output_ids = model.generate(
|
28 |
+
**data,
|
29 |
+
generation_config=generation_config
|
30 |
+
)[0]
|
31 |
+
print(tokenizer.decode(data["input_ids"][0].tolist()))
|
32 |
+
out = tokenizer.decode(output_ids.tolist())
|
33 |
+
return out
|
34 |
+
|
35 |
+
while 1:
|
36 |
+
generate(input(":> "))
|
37 |
+
|
38 |
+
```
|
39 |
+
# Citation
|
40 |
+
```
|
41 |
+
@MISC{Den4ikAI/FRED-T5-XL_instructor,
|
42 |
+
author = {Denis Petrov},
|
43 |
+
title = {Russian Instructor Model},
|
44 |
+
url = {https://huggingface.co/Den4ikAI/FRED-T5-XL_instructor/},
|
45 |
+
year = 2023
|
46 |
+
}
|
47 |
+
```
|