Update cli_demo.py

pull/9/head
Aohan Zeng 2023-03-14 03:06:37 +08:00 committed by GitHub
parent 9b0c929741
commit 3aaf9d3456
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -6,14 +6,15 @@ model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).ha
model = model.eval()
history = []
print("欢迎使用 ChatGLM-6B 模型输入内容即可进行对话clear 清空对话历史stop 终止程序")
while True:
query = input("请输入提示clear清空对话历史stop终止程序\n")
query = input("\n用户:")
if query == "stop":
break
if query == "clear":
history = []
os.system('clear')
continue
print("回复:")
response, history = model.chat(tokenizer, query, history=history)
print(response)
print(f"ChatGLM-6B{response}")