fix badcase for 14b

main
兼欣 1 year ago
parent 5f96ce9420
commit a91ba426d1

@ -25,15 +25,16 @@ for _ in range(10): # 网络不稳定,多试几次
name, device_map="auto", trust_remote_code=True name, device_map="auto", trust_remote_code=True
).eval() ).eval()
model.generation_config = generation_config model.generation_config = generation_config
model.generation_config.top_k = 1
break break
except Exception: except Exception as e:
pass print(e)
# 将一个插件的关键信息拼接成一段文本的模版。 # 将一个插件的关键信息拼接成一段文本的模版。
TOOL_DESC = """{name_for_model}: Call this tool to interact with the {name_for_human} API. What is the {name_for_human} API useful for? {description_for_model} Parameters: {parameters}""" TOOL_DESC = """{name_for_model}: Call this tool to interact with the {name_for_human} API. What is the {name_for_human} API useful for? {description_for_model} Parameters: {parameters}"""
# ReAct prompting 的 instruction 模版,将包含插件的详细信息。 # ReAct prompting 的 instruction 模版,将包含插件的详细信息。
PROMPT_REACT = """Answer the following questions as best you can. You have access to the following tools: PROMPT_REACT = """Answer the following questions as best you can. You have access to the following APIs:
{tools_text} {tools_text}
@ -236,7 +237,7 @@ def test():
}, },
] ]
history = [] history = []
for query in ['你好', '一下谁是周杰伦', '搜下他老婆是谁', '给我画个可爱的小猫吧,最好是黑猫']: for query in ['你好', '搜索一下谁是周杰伦', '搜下他老婆是谁', '给我画个可爱的小猫吧,最好是黑猫']:
print(f"User's Query:\n{query}\n") print(f"User's Query:\n{query}\n")
response, history = llm_with_plugin(prompt=query, history=history, list_of_plugin_info=tools) response, history = llm_with_plugin(prompt=query, history=history, list_of_plugin_info=tools)
print(f"Qwen's Response:\n{response}\n") print(f"Qwen's Response:\n{response}\n")
@ -254,7 +255,7 @@ Thought: 提供的工具对回答该问题帮助较小,我将不使用工具
Final Answer: 你好很高兴见到你有什么我可以帮忙的吗 Final Answer: 你好很高兴见到你有什么我可以帮忙的吗
User's Query: User's Query:
一下谁是周杰伦 搜索一下谁是周杰伦
Qwen's Response: Qwen's Response:
Thought: 我应该使用Google搜索查找相关信息 Thought: 我应该使用Google搜索查找相关信息
@ -265,7 +266,7 @@ Thought: I now know the final answer.
Final Answer: 周杰伦Jay Chou是一位来自台湾的歌手词曲创作人音乐制作人说唱歌手演员电视节目主持人和企业家他以其独特的音乐风格和才华在华语乐坛享有很高的声誉 Final Answer: 周杰伦Jay Chou是一位来自台湾的歌手词曲创作人音乐制作人说唱歌手演员电视节目主持人和企业家他以其独特的音乐风格和才华在华语乐坛享有很高的声誉
User's Query: User's Query:
搜下他老婆是谁 搜下他老婆是谁
Qwen's Response: Qwen's Response:
Thought: 我应该使用Google搜索查找相关信息 Thought: 我应该使用Google搜索查找相关信息

Loading…
Cancel
Save