Vitrous commited on
Commit
720cf2b
·
verified ·
1 Parent(s): e8a19d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -88,9 +88,10 @@ def generate_response(prompt: str) -> str:
88
 
89
  prompt_template = f'{PERSONA_DESC}\n\nASSISTANT: {prompt}\n'
90
 
91
- input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.to(model.device)
92
- output = model.generate(input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_length=512)
93
- generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
 
94
 
95
  return generated_text
96
 
 
88
 
89
  prompt_template = f'{PERSONA_DESC}\n\nASSISTANT: {prompt}\n'
90
 
91
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
92
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
93
+ generated_text = tokenizer.decode(output[0])
94
+
95
 
96
  return generated_text
97