loocorez commited on
Commit
f9d267c
·
verified ·
1 Parent(s): 769bf82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -54,11 +54,11 @@ def reverse(user_msg: str) -> str:
54
  )
55
  prompt = build_prompt(user_msg, tokenizer)
56
  with torch.inference_mode():
 
57
  out = model.generate(
58
- tokenizer(prompt, return_tensors="pt").to(model.device),
59
  max_new_tokens=64,
60
- do_sample=False,
61
- temperature=0.0
62
  )
63
  full = tokenizer.decode(out[0], skip_special_tokens=True)
64
  return full[len(prompt):] # strip the prompt – return only the reply
 
54
  )
55
  prompt = build_prompt(user_msg, tokenizer)
56
  with torch.inference_mode():
57
+ encoded = tokenizer(prompt, return_tensors="pt").to(model.device)
58
  out = model.generate(
59
+ **encoded, # <- pass as keyword args
60
  max_new_tokens=64,
61
+ do_sample=False # temperature becomes irrelevant
 
62
  )
63
  full = tokenizer.decode(out[0], skip_special_tokens=True)
64
  return full[len(prompt):] # strip the prompt – return only the reply