Spaces:
Runtime error
Runtime error
Sarath Shekkizhar
commited on
Commit
·
22b555c
1
Parent(s):
194b566
Update app.py
Browse filesadding generation prompt while applying chat template
app.py
CHANGED
@@ -55,7 +55,7 @@ def generate(
|
|
55 |
# if not message.strip():
|
56 |
# return "It looks like your message is empty. How can I assist you today?"
|
57 |
|
58 |
-
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt")
|
59 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
60 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
61 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
|
|
55 |
# if not message.strip():
|
56 |
# return "It looks like your message is empty. How can I assist you today?"
|
57 |
|
58 |
+
input_ids = tokenizer.apply_chat_template(conversation, add_generation_prompt = True, return_tensors="pt")
|
59 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
60 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
61 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|