Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,15 +21,13 @@ 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 |
-
# Generate tokens
|
25 |
gen_tokens = model.generate(
|
26 |
-
input_ids
|
27 |
-
|
28 |
do_sample=True,
|
29 |
temperature=temperature,
|
30 |
)
|
31 |
|
32 |
-
# Decode tokens to string
|
33 |
gen_text = tokenizer.decode(gen_tokens[0])
|
34 |
return gen_text
|
35 |
|
|
|
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
|
27 |
do_sample=True,
|
28 |
temperature=temperature,
|
29 |
)
|
30 |
|
|
|
31 |
gen_text = tokenizer.decode(gen_tokens[0])
|
32 |
return gen_text
|
33 |
|