InternLM / Tutorial

LLM&VLM Tutorial
1.33k stars 925 forks source link

天气agent的问题,无输出 #288

Open szhowardhuang opened 8 months ago

szhowardhuang commented 8 months ago

我跑了范例,发现没有输出。然后我进行debug。 debug到这个信息,麻烦指点一下,为什么actionReturn 一个 NoAction?

前面输出正常 image

后面action出错 image

debug位置 image

感觉adapter有问题,

比如 prompt如下: [{'role': 'system', 'content': "你是一个可以调用外部工具的助手,可以使用的工具包括:\n{'GoogleSearch': '一个可以从谷歌搜索结果的API。\n当你需要对于一个特定问题找到简短明了的回答时,可以使用它。\n输入应该是一个搜索查询。\n'}\n如果使用工具请遵循以下格式回复:\n\nThought:思考你当前步骤需要解决什么问题,是否需要使用工具\nAction:工具名称,你的工具必须从 [['GoogleSearch']] 选择\nAction Input:工具输入参数\n\n工具返回按照以下格式回复:\n\nResponse:调用工具后的结果\n\n如果你已经知道了答案,或者你不需要工具,请遵循以下格式回复\n\nThought:给出最终答案的思考过程\nFinal Answer:最终答案\n\n开始!"}, {'role': 'user', 'content': '深圳明天的天气?'}]

模型会回应如下: "Thought:我需要查询天气预报API来回答这个问题。\nAction:forecast_weather\nAction Input:{'location': '深圳', 'days': 1}}"

追踪到lagent/actions/action_executor.py 发现forecast_weather不合法, 程序只能接受GoogleSearch,也就是说模型不给出GoogleSearch的action就无法获得结果。 到了react.py chat第4轮, 如果action是 NoAction,那么就会得到空值。 如果没有在4轮以内收到action是FinishAction,那么得到一个default_response,无法回答问题。

感觉debug差不多了, 估计要麻烦老师看一下魔搭的adapter了。

woodx9 commented 8 months ago

image 加一,实验失败了

liuwake commented 2 months ago

Me too.

double enter to end input (EXIT: exit chat, RESET: reset history) >>> How's the weather at Ji'nan?

The attention mask is not set and cannot be inferred from input because pad token is same as eos token.As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.
Sorry that I cannot answer your question.

double enter to end input (EXIT: exit chat, RESET: reset history) >>> Who are you?

 Based on my search using the GoogleSearch API, I was not able to find the answer to your question about Ji'nan's weather. It seems that the search query was not specific enough. Is there anything else I can assist you with?

double enter to end input (EXIT: exit chat, RESET: reset history) >>> How's the weather in Tokyo?

 According to the get_weather_today API, the current weather in Tokyo is [insert observation here].

double enter to end input (EXIT: exit chat, RESET: reset history) >>> 
CostaliyA commented 1 month ago

你好,请问你们解决了吗,我目前遇到的问题是 image