Spaces:
Running
on
Zero
Running
on
Zero
Add generation prompt
Browse files
app.py
CHANGED
@@ -57,7 +57,7 @@ def generate(
|
|
57 |
conversation += chat_history
|
58 |
conversation.append({"role": "user", "content": message})
|
59 |
|
60 |
-
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt")
|
61 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
62 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
63 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
|
|
57 |
conversation += chat_history
|
58 |
conversation.append({"role": "user", "content": message})
|
59 |
|
60 |
+
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt", add_generation_prompt=True)
|
61 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
62 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
63 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|