Log the conversation
Browse files
app.py
CHANGED
@@ -58,6 +58,8 @@ def generate(
|
|
58 |
conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
|
59 |
conversation.append({"role": "user", "content": message})
|
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.")
|
|
|
58 |
conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
|
59 |
conversation.append({"role": "user", "content": message})
|
60 |
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt")
|
61 |
+
print(tokenizer.apply_chat_template(conversation, tokenize=False))
|
62 |
+
print(conversation)
|
63 |
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
64 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
65 |
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|