modelscope / modelscope-agent

ModelScope-Agent: An agent framework connecting models in ModelScope with the world
https://modelscope-agent.readthedocs.io/en/latest/
Apache License 2.0
2.61k stars 298 forks source link

AGent的推理方式问题 #312

Closed CaC033 closed 5 months ago

CaC033 commented 6 months ago

框架在使用本地调用msagent-7B模型的使用的是MSPromptGenerator推理方式,而在用灵积接口的时候却调用的是QwenPromptGenerator推理方式。 我想请问一下各位老师,这个默认的推理方式应该如何修改?如果现在要对qwen-tubor或者qwen1.5进行微调训练,推荐使用哪种推理方式?

mushenL commented 6 months ago

您好,关于微调训练建议可以参考这个文档 https://github.com/modelscope/swift/blob/main/docs/source/LLM/Agent%E5%BE%AE%E8%B0%83%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.md 关于您说的使用PromptGenerator推理方式,可以给出相应的代码位置我们这边帮您看看

CaC033 commented 6 months ago

您好,关于微调训练建议可以参考这个文档 https://github.com/modelscope/swift/blob/main/docs/source/LLM/Agent%E5%BE%AE%E8%B0%83%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.md 关于您说的使用PromptGenerator推理方式,可以给出相应的代码位置我们这边帮您看看

您好,我看了一下训练文档,我还是有一些疑惑的地方想向您请教,我向您说明一下我的理解,麻烦您帮忙纠正解答一下: """ Action:实际调用的API名称 Action Input: 实际的输入参数 Observation: 该部分是实际调用结果,训练时不参与loss,推理时需要外部调用后填入模型 Thought: 模型思考输出 Final Answer: 模型的最终回答 """ 我理解Action、Action Input两个部分的内容应该是模型自己生成的,Observation中的内容是框架提取Action Input中的数据执行工具的结果。我这里的疑问是Thought和Final Answer应该都是需要大模型输出的,那么连接Observation与Thought 以及Final Answer的user prompt是什么?

MsPromptGenerator推理方式的路径在/modelscope-agent/modelscope_agent/prompt/ms_prompt.py 但是我调用灵积的模型的时候应该用的是/modelscope-agent/modelscope_agent/prompt/qwen_prompt.py 中的QwenPromptGenerator 以下是我调用灵积平台模型的代码: “”“ additional_tool_list = { 'RenewInstance': HuolalaInfo(), 'RenewInstance2': HuolalaCar() }

agent = AgentExecutor(llm, additional_tool_list=additional_tool_list, tool_retrieval=False) available_tool_list = ['RenewInstance', 'RenewInstance2'] agent.set_available_tools(available_tool_list) ”“”

mushenL commented 6 months ago

您好,关于您提出来的疑惑,微调训练文档里面建议您使用魔搭通用Agent训练数据集,不同模型由于能力不同、训练数据的组织格式存在差异等原因,所以调用时以生成效果好的回复,所使用的prompt也不同,关于user prompt部分具体可以参考swift对于llm的训练文档,训练这一块依赖的是swift,希望对您有帮助。 另外,您提供的代码文件应该是以前版本的,在新版本已经弃用,建议拉取最新master代码,参考readme.md,新版本进行了框架重构

zzhangpurdue commented 6 months ago

we

您好,关于微调训练建议可以参考这个文档 https://github.com/modelscope/swift/blob/main/docs/source/LLM/Agent%E5%BE%AE%E8%B0%83%E6%9C%80%E4%BD%B3%E5%AE%9E%E8%B7%B5.md 关于您说的使用PromptGenerator推理方式,可以给出相应的代码位置我们这边帮您看看

您好,我看了一下训练文档,我还是有一些疑惑的地方想向您请教,我向您说明一下我的理解,麻烦您帮忙纠正解答一下: """ Action:实际调用的API名称 Action Input: 实际的输入参数 Observation: 该部分是实际调用结果,训练时不参与loss,推理时需要外部调用后填入模型 Thought: 模型思考输出 Final Answer: 模型的最终回答 """ 我理解Action、Action Input两个部分的内容应该是模型自己生成的,Observation中的内容是框架提取Action Input中的数据执行工具的结果。我这里的疑问是Thought和Final Answer应该都是需要大模型输出的,那么连接Observation与Thought 以及Final Answer的user prompt是什么?

MsPromptGenerator推理方式的路径在/modelscope-agent/modelscope_agent/prompt/ms_prompt.py 但是我调用灵积的模型的时候应该用的是/modelscope-agent/modelscope_agent/prompt/qwen_prompt.py 中的QwenPromptGenerator 以下是我调用灵积平台模型的代码: “”“ additional_tool_list = { 'RenewInstance': HuolalaInfo(), 'RenewInstance2': HuolalaCar() }

agent = AgentExecutor(llm, additional_tool_list=additional_tool_list, tool_retrieval=False) available_tool_list = ['RenewInstance', 'RenewInstance2'] agent.set_available_tools(available_tool_list) ”“”

我们推荐用户使用最新的master上分支基于qwen系列进行agent能力的使用

zzhangpurdue commented 5 months ago

长时间未响应,有问题重新开。