Tonic commited on
Commit
ef2fea2
1 Parent(s): 8325138

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
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['input_ids'],
27
- max_length=max_new_tokens + input_ids['input_ids'].shape[1], # Adjusting max_length to account for input length
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