Vitrous commited on
Commit
fe8bf67
·
verified ·
1 Parent(s): 7f98c6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -62,7 +62,11 @@ def generate_response(prompt: str) -> dict:
62
  repetition_penalty=1.1
63
  )
64
  # Generate the response
65
- generated_response = pipe(prompt_template)[0]['generated_text']
 
 
 
 
66
 
67
  return {"user": prompt, "assistant": generated_response}
68
 
 
62
  repetition_penalty=1.1
63
  )
64
  # Generate the response
65
+ #generated_response = pipe(prompt_template)[0]['generated_text']
66
+
67
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
68
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
69
+ generated_response = (tokenizer.decode(output[0]))
70
 
71
  return {"user": prompt, "assistant": generated_response}
72