Spaces:
Sleeping
Sleeping
Commit
·
d1ce4f8
1
Parent(s):
8400d16
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def generate(input, chat_history=[], system_prompt=False, max_new_tokens=512, te
|
|
32 |
})
|
33 |
|
34 |
input_ids = tokenizer.apply_chat_template(conversation, return_tensors='pt')
|
35 |
-
if input_ids.shape[1] >
|
36 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
37 |
gr.Warning(f"Trimed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
38 |
input_ids = input_ids.to(model.device)
|
|
|
32 |
})
|
33 |
|
34 |
input_ids = tokenizer.apply_chat_template(conversation, return_tensors='pt')
|
35 |
+
if input_ids.shape[1] > MAX_INPUT_TOKEN_LENGTH:
|
36 |
input_ids = input_ids[:, -MAX_INPUT_TOKEN_LENGTH:]
|
37 |
gr.Warning(f"Trimed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
|
38 |
input_ids = input_ids.to(model.device)
|