Skip to content

Commit 1471702

Browse files
authored
Update app.py
1 parent e348ac8 commit 1471702

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

demo/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def generate(
4848
conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
4949
conversation.append({"role": "user", "content": message})
5050

51-
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt")
51+
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt", add_generation_prompt=True)
5252
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
5353
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
5454
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")

0 commit comments

Comments
 (0)