Update app.py
Browse files
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
|
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
|