mirror of
https://github.com/deepseek-ai/DeepSeek-Coder
synced 2024-12-04 18:14:44 +00:00
Update app.py
This commit is contained in:
parent
e348ac8619
commit
147170214b
@ -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.")
|
||||
|
Loading…
Reference in New Issue
Block a user