File size: 1,447 Bytes
e9b382d
450c228
 
 
81e6436
450c228
 
 
81e6436
450c228
e9b382d
 
450c228
e9b382d
 
450c228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
language:
- ru
pipeline_tag: text2text-generation
tags:
-  T5
-  russian
-  text2text-generation
-  text-generation
---

Модель [ruT5-base](https://huggingface.co/ai-forever/ruT5-base) была fine-tuned для задачи __text-to-text__, предназначенная для __Russian__ текст.

## Uses
```
from transformers import AutoTokenizer, T5ForConditionalGeneration

chat_checkpoint = 'r1char9/T5_chat'
chat_model = T5ForConditionalGeneration.from_pretrained(chat_checkpoint)
chat_tokenizer = AutoTokenizer.from_pretrained(chat_checkpoint)

text='Что самое главное в человеке ?'

def chat_fun(self, text: str):
    tokenized_sentence = self.chat_tokenizer(text, return_tensors='pt', truncation=True)
    res = self.chat_model.generate(**tokenized_sentence, num_beams=2, max_length=100)            
    return self.chat_tokenizer.decode(res[0], skip_special_tokens=True)
    

text = chat_fun(text=text)
# Самое главное в человеке - это его любовь и уважение к другим людям. 
# Это означает, что он должен быть искренним и искренним в своих мыслях и чувствах, 
# а также готов жертвовать своим личным и профессиональным идеалами и ценностям, чтобы достичь своих целей.
```