Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_c
|
|
20 |
def generate_response(user_input, max_new_tokens, temperature):
|
21 |
messages = [{"role": "user", "content": user_input}]
|
22 |
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
23 |
-
|
24 |
gen_tokens = model.generate(
|
25 |
input_ids = input_ids,
|
26 |
max_new_tokens=max_new_tokens,
|
|
|
20 |
def generate_response(user_input, max_new_tokens, temperature):
|
21 |
messages = [{"role": "user", "content": user_input}]
|
22 |
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
23 |
+
input_ids = input_ids.to(model.device)
|
24 |
gen_tokens = model.generate(
|
25 |
input_ids = input_ids,
|
26 |
max_new_tokens=max_new_tokens,
|