yilunzhao commited on
Commit
16242e1
1 Parent(s): b0f0f9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -20,7 +20,7 @@ def generate_response(passage: str, question: str) -> str:
20
  inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
21
 
22
  # Generate text, focusing only on the new tokens added by the model
23
- outputs = model.generate(inputs.input_ids, max_new_tokens=150)
24
 
25
  # Decode only the generated part, skipping the prompt input
26
  # generated_tokens = outputs[0][inputs.input_ids.shape[-1]:] # Ignore input tokens in the output
 
20
  inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
21
 
22
  # Generate text, focusing only on the new tokens added by the model
23
+ outputs = model.generate(**inputs, max_new_tokens=150)
24
 
25
  # Decode only the generated part, skipping the prompt input
26
  # generated_tokens = outputs[0][inputs.input_ids.shape[-1]:] # Ignore input tokens in the output