michailroussos commited on
Commit
c8a8974
·
1 Parent(s): 1ea5080

small changes

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -32,7 +32,9 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
32
  tokenize=True,
33
  add_generation_prompt=True,
34
  return_tensors="pt",
35
- ).to("cuda" if torch.cuda.is_available() else "cpu")
 
 
36
 
37
  output = model.generate(
38
  input_ids=inputs,
@@ -54,6 +56,7 @@ demo = gr.ChatInterface(
54
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
55
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
56
  ],
 
57
  )
58
 
59
  if __name__ == "__main__":
 
32
  tokenize=True,
33
  add_generation_prompt=True,
34
  return_tensors="pt",
35
+ )
36
+ inputs = inputs.to("cuda" if torch.cuda.is_available() else "cpu")
37
+ attention_mask = inputs.ne(tokenizer.pad_token_id).long()
38
 
39
  output = model.generate(
40
  input_ids=inputs,
 
56
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
57
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
58
  ],
59
+ type="messages"
60
  )
61
 
62
  if __name__ == "__main__":