From 607cf8e55475cea5f299b75e6c346c6e6c96cbb2 Mon Sep 17 00:00:00 2001 From: Timothyxxx <384084775@qq.com> Date: Mon, 25 Mar 2024 18:09:43 +0800 Subject: [PATCH] Fix max traj length --- mm_agents/agent.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mm_agents/agent.py b/mm_agents/agent.py index 5ed3d27..a4b1b3a 100644 --- a/mm_agents/agent.py +++ b/mm_agents/agent.py @@ -264,9 +264,14 @@ class PromptAgent: , "The number of observations and actions should be the same." if len(self.observations) > self.max_trajectory_length: - _observations = self.observations[-self.max_trajectory_length:] - _actions = self.actions[-self.max_trajectory_length:] - _thoughts = self.thoughts[-self.max_trajectory_length:] + if self.max_trajectory_length == 0: + _observations = [] + _actions = [] + _thoughts = [] + else: + _observations = self.observations[-self.max_trajectory_length:] + _actions = self.actions[-self.max_trajectory_length:] + _thoughts = self.thoughts[-self.max_trajectory_length:] else: _observations = self.observations _actions = self.actions