mirror of
https://github.com/deepseek-ai/DeepSeek-Coder.git
synced 2026-10-26 16:45:27 +00:00
Update app.py
This commit is contained in:
1 parent
e348ac8619
commit
147170214b
1 file changed
+1
-1
+1
-1
@@ -48,7 +48,7 @@ def generate(
|
||||
conversation.extend([{"role": "user", "content": user}, {"role": "assistant", "content": assistant}])
|
||||
conversation.append({"role": "user", "content": message})
|
||||
|
||||
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt")
|
||||
input_ids = tokenizer.apply_chat_template(conversation, return_tensors="pt", add_generation_prompt=True)
|
||||
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
||||
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
||||
gr.Warning(f"Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
||||
|
||||
Reference in new issue
Block a user