yilunzhao commited on
Commit
b0f0f9e
1 Parent(s): 287a635

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,8 +23,8 @@ def generate_response(passage: str, question: str) -> str:
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
27
- response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
28
 
29
  return response
30
 
 
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
27
+ response = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
28
 
29
  return response
30