yilunzhao commited on
Commit
7eb73dd
1 Parent(s): 0f4c433

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -22,7 +22,7 @@ def generate_response(passage: str, question: str) -> str:
22
  inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
23
  response = model.generate(input_ids=inputs.to(model.device), max_new_tokens=100)
24
 
25
- response = tokenizer.batch_decode(response, skip_special_tokens=True)[0]
26
 
27
 
28
  return response
 
22
  inputs = tokenizer.encode(prompt, add_special_tokens=False, return_tensors="pt")
23
  response = model.generate(input_ids=inputs.to(model.device), max_new_tokens=100)
24
 
25
+ response = tokenizer.batch_decode(response, skip_special_tokens=True)[0].split("<|assistant|>")[-1].strip()
26
 
27
 
28
  return response