Spaces:
Paused
Paused
Update utils.py
Browse files
utils.py
CHANGED
@@ -63,7 +63,7 @@ def generate_prompt_with_history(text, history, tokenizer, max_length=2048):
|
|
63 |
else:
|
64 |
break
|
65 |
|
66 |
-
print(history)
|
67 |
|
68 |
if flag:
|
69 |
return prompt+history_text,tokenizer(prompt+history_text, return_tensors="pt")
|
@@ -125,9 +125,6 @@ def load_tokenizer_and_model_gpt2(base_model,load_8bit=False):
|
|
125 |
|
126 |
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
|
132 |
def load_tokenizer_and_model_bloke_gpt(base_model, model_basename):
|
133 |
use_triton = False
|
@@ -193,7 +190,7 @@ def greedy_search(input_ids: torch.Tensor,
|
|
193 |
|
194 |
generated_tokens.append(next_token[0].item())
|
195 |
text = tokenizer.decode(generated_tokens)
|
196 |
-
|
197 |
yield text
|
198 |
if any([x in text for x in stop_words]):
|
199 |
del past_key_values
|
|
|
63 |
else:
|
64 |
break
|
65 |
|
66 |
+
#print(history)
|
67 |
|
68 |
if flag:
|
69 |
return prompt+history_text,tokenizer(prompt+history_text, return_tensors="pt")
|
|
|
125 |
|
126 |
|
127 |
|
|
|
|
|
|
|
128 |
|
129 |
def load_tokenizer_and_model_bloke_gpt(base_model, model_basename):
|
130 |
use_triton = False
|
|
|
190 |
|
191 |
generated_tokens.append(next_token[0].item())
|
192 |
text = tokenizer.decode(generated_tokens)
|
193 |
+
time.sleep(0.10)
|
194 |
yield text
|
195 |
if any([x in text for x in stop_words]):
|
196 |
del past_key_values
|