mirror of https://github.com/THUDM/ChatGLM-6B
Update cli_demo.py
parent
9b0c929741
commit
3aaf9d3456
|
@ -6,14 +6,15 @@ model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).ha
|
||||||
model = model.eval()
|
model = model.eval()
|
||||||
|
|
||||||
history = []
|
history = []
|
||||||
|
print("欢迎使用 ChatGLM-6B 模型,输入内容即可进行对话,clear 清空对话历史,stop 终止程序")
|
||||||
while True:
|
while True:
|
||||||
query = input("请输入提示,clear清空对话历史,stop终止程序:\n")
|
query = input("\n用户:")
|
||||||
if query == "stop":
|
if query == "stop":
|
||||||
break
|
break
|
||||||
if query == "clear":
|
if query == "clear":
|
||||||
history = []
|
history = []
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
continue
|
continue
|
||||||
print("回复:")
|
|
||||||
response, history = model.chat(tokenizer, query, history=history)
|
response, history = model.chat(tokenizer, query, history=history)
|
||||||
print(response)
|
print(f"ChatGLM-6B:{response}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue