cointegrated commited on
Commit
6a8dd47
1 Parent(s): afb00fa

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -0
README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "ru"
3
+ tags:
4
+ - dialogue
5
+ - russian
6
+ license: mit
7
+ ---
8
+
9
+ This is a version of the [cointegrated/rut5-small](https://huggingface.co/cointegrated/rut5-small) model fine-tuned on some Russian dialogue data. It is not very smart and creative, but it is small and fast, and can serve as a fallback response generator for some chatbot or can be fine-tuned to imitate the style of someone.
10
+
11
+ The input of the model is the previous dialogue utterances separated by `'\n\n'`, and the output is the next utterance.
12
+
13
+ The model can be used as follows:
14
+ ```
15
+ # !pip install transformers sentencepiece
16
+ import torch
17
+ from transformers import T5ForConditionalGeneration, T5Tokenizer
18
+
19
+ tokenizer = T5Tokenizer.from_pretrained("cointegrated/rut5-small-chitchat")
20
+ model = T5ForConditionalGeneration.from_pretrained("cointegrated/rut5-small-chitchat")
21
+
22
+ text = 'Привет! Расскажи, как твои дела?'
23
+ inputs = tokenizer(text, return_tensors='pt')
24
+ with torch.no_grad():
25
+ hypotheses = model.generate(
26
+ **inputs,
27
+ do_sample=True, top_p=0.5, num_return_sequences=3,
28
+ repetition_penalty=2.5,
29
+ max_length=32,
30
+ )
31
+ for h in hypotheses:
32
+ print(tokenizer.decode(h, skip_special_tokens=True))
33
+ # Как обычно.
34
+ # Сейчас - в порядке.
35
+ # Хорошо.
36
+ # Wall time: 363 ms
37
+ ```