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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -17,7 +17,7 @@ else:
17
  def generate_response(passage: str, question: str) -> str:
18
  # Prepare the input text by combining the passage and question
19
  messages = [{"role": "user", "content": f"Passage: {passage}\nQuestion: {question}"}]
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)
 
17
  def generate_response(passage: str, question: str) -> str:
18
  # Prepare the input text by combining the passage and question
19
  messages = [{"role": "user", "content": f"Passage: {passage}\nQuestion: {question}"}]
20
+ inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
21
 
22
  # Generate text, focusing only on the new tokens added by the model
23
  outputs = model.generate(**inputs, max_new_tokens=150)