Spaces:
Runtime error
Runtime error
dennis-fast
commited on
Commit
•
d7e3201
1
Parent(s):
25ab3ef
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import torch
|
|
4 |
|
5 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
6 |
|
7 |
-
|
8 |
-
model_name = 'luca-martial/DialoGPT-Elon'
|
9 |
|
10 |
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
11 |
model = GPT2LMHeadModel.from_pretrained(model_name)
|
@@ -19,13 +19,14 @@ def predict(input, history=[]):
|
|
19 |
|
20 |
# generate a response
|
21 |
history = model.generate(bot_input_ids,
|
22 |
-
max_length=
|
|
|
23 |
pad_token_id=tokenizer.eos_token_id,
|
24 |
-
no_repeat_ngram_size=3,
|
25 |
-
do_sample=True,
|
26 |
-
top_k=100,
|
27 |
-
top_p=0.7,
|
28 |
-
temperature = 0.8
|
29 |
).tolist()
|
30 |
|
31 |
# convert the tokens to text, and then split the responses into the right format
|
|
|
4 |
|
5 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
6 |
|
7 |
+
model_name = 'dennis-fast/DialoGPT-ElonMusk'
|
8 |
+
#model_name = 'luca-martial/DialoGPT-Elon'
|
9 |
|
10 |
tokenizer = GPT2Tokenizer.from_pretrained(model_name)
|
11 |
model = GPT2LMHeadModel.from_pretrained(model_name)
|
|
|
19 |
|
20 |
# generate a response
|
21 |
history = model.generate(bot_input_ids,
|
22 |
+
max_length=1000,
|
23 |
+
#max_length=200,
|
24 |
pad_token_id=tokenizer.eos_token_id,
|
25 |
+
#no_repeat_ngram_size=3,
|
26 |
+
#do_sample=True,
|
27 |
+
#top_k=100,
|
28 |
+
#top_p=0.7,
|
29 |
+
#temperature = 0.8
|
30 |
).tolist()
|
31 |
|
32 |
# convert the tokens to text, and then split the responses into the right format
|