add continuous output for CLI

This commit is contained in:
PhaneeshB
2023-05-12 00:43:17 +05:30
committed by Phaneesh Barwaria
parent 20114deea0
commit 6602a2f5ba

View File

@@ -645,6 +645,11 @@ if __name__ == "__main__":
break
new_sentence += [new_token]
tokens.append(new_token)
detok = tokenizer.decode(new_token)
if detok == "<0x0A>":
print("\n", end="", flush=True)
else:
print(f"{detok}", end=" ", flush=True)
original_input_ids.append(new_token)
input_ids = [new_token]
@@ -652,5 +657,8 @@ if __name__ == "__main__":
if type(tokens[i]) != int:
tokens[i] = int(tokens[i][0])
new_sentence_str = tokenizer.decode(new_sentence)
print(new_sentence_str)
print(
"\n-----\nRobot: Here's the complete formatted reply:\n",
new_sentence_str,
)
prompt_history += f"\n{new_sentence_str}\n"