solemn-leader
commited on
Commit
•
aaf0936
1
Parent(s):
1322998
Update README.md
Browse files
README.md
CHANGED
@@ -36,20 +36,20 @@ from transformers import AutoTokenizer, AutoModelWithLMHead
|
|
36 |
tokenizer = AutoTokenizer.from_pretrained('tinkoff-ai/ruDialoGPT-small')
|
37 |
model = AutoModelWithLMHead.from_pretrained('tinkoff-ai/ruDialoGPT-small')
|
38 |
inputs = tokenizer('@@ПЕРВЫЙ@@ привет @@ВТОРОЙ@@ привет @@ПЕРВЫЙ@@ как дела? @@ВТОРОЙ@@', return_tensors='pt')
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
context_with_response
|
55 |
```
|
|
|
36 |
tokenizer = AutoTokenizer.from_pretrained('tinkoff-ai/ruDialoGPT-small')
|
37 |
model = AutoModelWithLMHead.from_pretrained('tinkoff-ai/ruDialoGPT-small')
|
38 |
inputs = tokenizer('@@ПЕРВЫЙ@@ привет @@ВТОРОЙ@@ привет @@ПЕРВЫЙ@@ как дела? @@ВТОРОЙ@@', return_tensors='pt')
|
39 |
+
generated_token_ids = model.generate(
|
40 |
+
**inputs,
|
41 |
+
top_k=10,
|
42 |
+
top_p=0.95,
|
43 |
+
num_beams=3,
|
44 |
+
num_return_sequences=3,
|
45 |
+
do_sample=True,
|
46 |
+
no_repeat_ngram_size=2,
|
47 |
+
temperature=1.2,
|
48 |
+
repetition_penalty=1.2,
|
49 |
+
length_penalty=1.0,
|
50 |
+
eos_token_id=50257,
|
51 |
+
max_new_tokens=40
|
52 |
+
)
|
53 |
+
context_with_response = [tokenizer.decode(sample_token_ids) for sample_token_ids in generated_token_ids]
|
54 |
context_with_response
|
55 |
```
|