mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-18 18:20:08 +00:00
fix: integrate PR #3315 review feedback
- envs(robotwin): default `observation_height/width` in `create_robotwin_envs` to `DEFAULT_CAMERA_H/W` (240/320) so they match the D435 dims baked into `task_config/demo_clean.yml`. - envs(robotwin): resolve `task_config/demo_clean.yml` via `CONFIGS_PATH` instead of a cwd-relative path; works regardless of where `lerobot-eval` is invoked. - envs(robotwin): replace `print()` calls in `create_robotwin_envs` with `logger.info(...)` (module-level `logger = logging.getLogger`). - envs(robotwin): use `_LazyAsyncVectorEnv` for the async path so async workers start lazily (matches LIBERO / RoboCasa / VLABench). - envs(robotwin): cast `agent_pos` space + joint-state output to float32 end-to-end (was mixed float64/float32). - envs(configs): use the existing `_make_vec_env_cls(use_async, n_envs)` helper in `RoboTwinEnvConfig.create_envs`; drop the `get_env_processors` override so RoboTwin uses the identity processor inherited from `EnvConfig`. - processor: delete `RoboTwinProcessorStep` — the float32 cast now happens in the wrapper itself, so the processor is redundant. - tests: drop the `TestRoboTwinProcessorStep` suite; update the mock obs fixture to use float32 `joint_action.vector`. - ci: hoist `ROBOTWIN_POLICY` and `ROBOTWIN_TASKS` to job-level env vars so the task list and policy aren't duplicated across eval / extract / parse steps. - docker: pin RoboTwin + CuRobo upstream clones to commit SHAs (`RoboTwin@0aeea2d6`, `curobo@ca941586`) for reproducibility. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,6 @@ from unittest.mock import MagicMock, patch
|
||||
import gymnasium as gym
|
||||
import numpy as np
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from lerobot.envs.robotwin import (
|
||||
ACTION_DIM,
|
||||
@@ -56,7 +55,7 @@ def _make_mock_task_env(
|
||||
"""
|
||||
obs_dict = {
|
||||
"observation": {cam: {"rgb": np.zeros((height, width, 3), dtype=np.uint8)} for cam in cameras},
|
||||
"joint_action": {"vector": np.zeros(ACTION_DIM, dtype=np.float64)},
|
||||
"joint_action": {"vector": np.zeros(ACTION_DIM, dtype=np.float32)},
|
||||
"endpose": {},
|
||||
}
|
||||
|
||||
@@ -281,34 +280,3 @@ def test_all_tasks_are_strings():
|
||||
|
||||
def test_no_duplicate_tasks():
|
||||
assert len(ROBOTWIN_TASKS) == len(set(ROBOTWIN_TASKS))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# RoboTwinProcessorStep
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestRoboTwinProcessorStep:
|
||||
def test_passes_through_images_and_state(self):
|
||||
from lerobot.processor.env_processor import RoboTwinProcessorStep
|
||||
from lerobot.utils.constants import OBS_IMAGES, OBS_STATE
|
||||
|
||||
step = RoboTwinProcessorStep()
|
||||
obs = {
|
||||
f"{OBS_IMAGES}.head_camera": torch.zeros(1, 3, 4, 4),
|
||||
f"{OBS_IMAGES}.left_camera": torch.zeros(1, 3, 4, 4),
|
||||
OBS_STATE: torch.zeros(1, 14),
|
||||
}
|
||||
result = step.observation(obs)
|
||||
assert f"{OBS_IMAGES}.head_camera" in result
|
||||
assert f"{OBS_IMAGES}.left_camera" in result
|
||||
assert result[OBS_STATE].dtype == torch.float32
|
||||
|
||||
def test_state_cast_to_float32(self):
|
||||
from lerobot.processor.env_processor import RoboTwinProcessorStep
|
||||
from lerobot.utils.constants import OBS_STATE
|
||||
|
||||
step = RoboTwinProcessorStep()
|
||||
obs = {OBS_STATE: torch.zeros(1, 14, dtype=torch.float64)}
|
||||
result = step.observation(obs)
|
||||
assert result[OBS_STATE].dtype == torch.float32
|
||||
|
||||
Reference in New Issue
Block a user