fix badcase in react_demo.py

main
兼欣 1 year ago
parent dbc111267a
commit 8da5dc0cbd

@ -18,13 +18,13 @@ from transformers.generation import GenerationConfig
for _ in range(10): # 网络不稳定,多试几次
try:
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True)
generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-7B-Chat", trust_remote_code=True)
name = 'Qwen/Qwen-7B-Chat'
tokenizer = AutoTokenizer.from_pretrained(name, trust_remote_code=True)
generation_config = GenerationConfig.from_pretrained(name, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen-7B-Chat", device_map="auto", trust_remote_code=True
name, device_map="auto", trust_remote_code=True
).eval()
model.generation_config = generation_config
model.generation_config.do_sample = False
break
except Exception:
pass
@ -236,7 +236,7 @@ def test():
},
]
history = []
for query in ['你好', '谁是周杰伦', '他老婆是谁', '给我画个可爱的小猫吧,最好是黑猫']:
for query in ['你好', '查一下谁是周杰伦', '搜下他老婆是谁', '给我画个可爱的小猫吧,最好是黑猫']:
print(f"User's Query:\n{query}\n")
response, history = llm_with_plugin(prompt=query, history=history, list_of_plugin_info=tools)
print(f"Qwen's Response:\n{response}\n")
@ -254,7 +254,7 @@ Thought: 提供的工具对回答该问题帮助较小,我将不使用工具
Final Answer: 你好很高兴见到你有什么我可以帮忙的吗
User's Query:
谁是周杰伦
查一下谁是周杰伦
Qwen's Response:
Thought: 我应该使用Google搜索查找相关信息
@ -265,7 +265,7 @@ Thought: I now know the final answer.
Final Answer: 周杰伦Jay Chou是一位来自台湾的歌手词曲创作人音乐制作人说唱歌手演员电视节目主持人和企业家他以其独特的音乐风格和才华在华语乐坛享有很高的声誉
User's Query:
他老婆是谁
搜下他老婆是谁
Qwen's Response:
Thought: 我应该使用Google搜索查找相关信息

Loading…
Cancel
Save