refactor(utils): enhance task handling in add_envs_task function

- Improved the `add_envs_task` function to validate the output of `task_description` and `task` calls, ensuring they return lists of strings.
- Removed the use of `else` statement for environments without language instructions, simplifying the logic and enhancing readability.
- Streamlined the observation dictionary handling by ensuring consistent data types for task attributes.
This commit is contained in:
AdilZouitine
2025-09-09 16:11:38 +02:00
parent 8b43339563
commit 15960f0b5e
2 changed files with 0 additions and 2 deletions
-1
View File
@@ -151,7 +151,6 @@ def add_envs_task(env: gym.vector.VectorEnv, observation: dict[str, Any]) -> dic
observation["task"] = task_result
else: # For envs without language instructions, e.g. aloha transfer cube and etc.
print(f"{observation.keys()}")
num_envs = observation[list(observation.keys())[0]].shape[0]
observation["task"] = ["" for _ in range(num_envs)]
return observation
-1
View File
@@ -155,7 +155,6 @@ def rollout(
while not np.all(done):
# Numpy array to tensor and changing dictionary keys to LeRobot policy format.
observation = preprocess_observation(observation)
observation = preprocessor(observation)
if return_observations:
all_observations.append(deepcopy(observation))