Corianas commited on
Commit
c836a45
·
1 Parent(s): 6814bfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -92,10 +92,11 @@ def get_model_list():
92
 
93
  def gen(input):
94
  #print(input)
 
95
  generated_text = ''
96
- start_ids = encode(add_caseifer(input))
97
- x = (torch.tensor(start_ids, dtype=torch.long, device=device)[None, ...])
98
- for idx_next in model.generate_streaming(x, max_new_tokens, temperature=temperature, top_k=top_k):
99
  # convert the index to a character and print it to the screen
100
  char = decode([idx_next])
101
  generated_text += char
 
92
 
93
  def gen(input):
94
  #print(input)
95
+ direction = 'You are Emldar, a chatbot.'
96
  generated_text = ''
97
+ x = (torch.tensor(encode(add_caseifer(input)), dtype=torch.long, device=device)[None, ...])
98
+ y = (torch.tensor(encode(add_caseifer(direction)), dtype=torch.long, device=device)[None, ...])
99
+ for idx_next in model.generate_instructed_streaming(x, y, max_new_tokens, temperature=temperature, top_k=top_k):
100
  # convert the index to a character and print it to the screen
101
  char = decode([idx_next])
102
  generated_text += char