wangzhang commited on
Commit
336c697
·
1 Parent(s): 8f14c60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -61,8 +61,7 @@ def generate(
61
 
62
  ### Response:
63
  """
64
- chat = tokenizer.apply_chat_template(prompt, tokenize=False)
65
- inputs = tokenizer(chat, return_tensors="pt", add_special_tokens=False).to("cuda")
66
  if len(inputs) > MAX_INPUT_TOKEN_LENGTH:
67
  inputs = inputs[-MAX_INPUT_TOKEN_LENGTH:]
68
  gr.Warning("Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")
 
61
 
62
  ### Response:
63
  """
64
+ inputs = tokenizer(prompt, return_tensors="pt", truncation=True).input_ids.cuda()
 
65
  if len(inputs) > MAX_INPUT_TOKEN_LENGTH:
66
  inputs = inputs[-MAX_INPUT_TOKEN_LENGTH:]
67
  gr.Warning("Trimmed input from conversation as it was longer than {MAX_INPUT_TOKEN_LENGTH} tokens.")