From d61941fe68a1dd7a8adbbc43d3ef0ec978927f1b Mon Sep 17 00:00:00 2001 From: Steven Palma Date: Thu, 2 Jul 2026 11:15:45 +0200 Subject: [PATCH] chore(evo1): delete added test + reduce diff --- src/lerobot/envs/configs.py | 6 +----- src/lerobot/scripts/lerobot_eval.py | 7 +------ tests/scripts/test_lerobot_eval.py | 14 -------------- 3 files changed, 2 insertions(+), 25 deletions(-) delete mode 100644 tests/scripts/test_lerobot_eval.py diff --git a/src/lerobot/envs/configs.py b/src/lerobot/envs/configs.py index e53f668a3..84c40472f 100644 --- a/src/lerobot/envs/configs.py +++ b/src/lerobot/envs/configs.py @@ -24,11 +24,7 @@ import gymnasium as gym from gymnasium.envs.registration import registry as gym_registry from lerobot.configs import FeatureType, PolicyFeature -from lerobot.processor import ( - IsaaclabArenaProcessorStep, - LiberoProcessorStep, - PolicyProcessorPipeline, -) +from lerobot.processor import IsaaclabArenaProcessorStep, LiberoProcessorStep, PolicyProcessorPipeline from lerobot.robots import RobotConfig from lerobot.teleoperators.config import TeleoperatorConfig from lerobot.utils.constants import ( diff --git a/src/lerobot/scripts/lerobot_eval.py b/src/lerobot/scripts/lerobot_eval.py index b71ea6dac..a91a29382 100644 --- a/src/lerobot/scripts/lerobot_eval.py +++ b/src/lerobot/scripts/lerobot_eval.py @@ -283,7 +283,7 @@ def rollout( action = action_transition[ACTION] # Convert to CPU / numpy. - action_numpy = _action_to_env_numpy(action) + action_numpy: np.ndarray = action.detach().to(device="cpu", dtype=torch.float32).numpy() assert action_numpy.ndim == 2, "Action dimensions should be (batch, action_dim)" # Apply the next action. @@ -384,11 +384,6 @@ def rollout( return ret -def _action_to_env_numpy(action: Tensor) -> np.ndarray: - """Convert policy actions to a NumPy array accepted by Gym environments.""" - return action.detach().to(device="cpu", dtype=torch.float32).numpy() - - def eval_policy( env: gym.vector.VectorEnv, policy: PreTrainedPolicy, diff --git a/tests/scripts/test_lerobot_eval.py b/tests/scripts/test_lerobot_eval.py deleted file mode 100644 index fd41296c5..000000000 --- a/tests/scripts/test_lerobot_eval.py +++ /dev/null @@ -1,14 +0,0 @@ -import numpy as np -import torch - -from lerobot.scripts.lerobot_eval import _action_to_env_numpy - - -def test_action_to_env_numpy_casts_bfloat16_to_float32(): - action = torch.tensor([[0.5, -1.0]], dtype=torch.bfloat16) - - action_numpy = _action_to_env_numpy(action) - - assert action_numpy.shape == (1, 2) - assert action_numpy.dtype == np.float32 - np.testing.assert_allclose(action_numpy, np.array([[0.5, -1.0]], dtype=np.float32))