From 64fbce018a79be331e9554cfec43f7b7aab3ea91 Mon Sep 17 00:00:00 2001 From: Ting-Jun Wang Date: Mon, 6 May 2024 16:41:07 +0800 Subject: [PATCH] feat: steps counter in llm-success --- nav_src/agent.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nav_src/agent.py b/nav_src/agent.py index d22a720..e0b5ddc 100644 --- a/nav_src/agent.py +++ b/nav_src/agent.py @@ -100,6 +100,7 @@ class NavGPTOutputParser(AgentOutputParser): print(f"SUCCESS = {SUCCESS}") NOW_LOCATION = tool_input + TEMP_STEPS_COUNTER += 1 print(f"NOW_LOCATION = {NOW_LOCATION}") @@ -120,6 +121,8 @@ class NavGPTOutputParser(AgentOutputParser): return AgentAction(action, tool_input, text) elif includes_answer: if NOW_LOCATION == FINAL_STOP_POINT: + STEPS_COUNTER += TEMP_STEPS_COUNTER + TEMP_STEPS_COUNTER = 0 SUCCESS += 1 print(f"SUCCESS = {SUCCESS}") else: @@ -128,6 +131,7 @@ class NavGPTOutputParser(AgentOutputParser): print(f"{NOW_LOCATION}_{type(NOW_LOCATION)}") print(f"{FINAL_STOP_POINT}_{type(FINAL_STOP_POINT)}") print(f"SUCCESS = {SUCCESS}") + print(f"STEPS_COUNTER = {STEPS_COUNTER}") return AgentFinish( {"output": text.split(FINAL_ANSWER_ACTION)[-1].strip()}, text ) @@ -712,6 +716,7 @@ class NavGPTAgent(BaseAgent): global FINAL_STOP_POINT global TEMP_STEPS_COUNTER + global STEPS_COUNTER global NOW_LOCATION FINAL_STOP_POINT = obs[0]['stop']