Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -92,10 +92,11 @@ def get_model_list():
|
|
92 |
|
93 |
def gen(input):
|
94 |
#print(input)
|
|
|
95 |
generated_text = ''
|
96 |
-
|
97 |
-
|
98 |
-
for idx_next in model.
|
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
|