Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,11 +7,13 @@ title = "EZChat"
|
|
| 7 |
description = "A State-of-the-Art Large-scale Pretrained Response generation model (DialoGPT-medium)"
|
| 8 |
examples = [["How are you?"]]
|
| 9 |
|
| 10 |
-
|
| 11 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-medium", padding_side='left')
|
| 12 |
model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium")
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
def predict(input, history=[]):
|
| 16 |
# tokenize the new input sentence
|
| 17 |
new_user_input_ids = tokenizer.encode(
|
|
|
|
| 7 |
description = "A State-of-the-Art Large-scale Pretrained Response generation model (DialoGPT-medium)"
|
| 8 |
examples = [["How are you?"]]
|
| 9 |
|
| 10 |
+
# Set the padding token to be used and initialize the model
|
| 11 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-medium", padding_side='left')
|
| 12 |
model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium")
|
| 13 |
+
tokenizer.add_special_tokens({'pad_token': '[EOS]'})
|
| 14 |
+
tokenizer.pad_token = tokenizer.eos_token
|
| 15 |
|
| 16 |
+
#predict
|
| 17 |
def predict(input, history=[]):
|
| 18 |
# tokenize the new input sentence
|
| 19 |
new_user_input_ids = tokenizer.encode(
|