forked from tangger/lerobot
Remove validate_robot_cameras_for_policy (#2150)
* Remove validate_robot_cameras_for_policy as with rename processor the image keys can be renamed an mapped * fix precommit
This commit is contained in:
@@ -142,11 +142,6 @@ class RobotClientConfig:
|
|||||||
default=False, metadata={"help": "Visualize the action queue size"}
|
default=False, metadata={"help": "Visualize the action queue size"}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verification configuration
|
|
||||||
verify_robot_cameras: bool = field(
|
|
||||||
default=True, metadata={"help": "Verify that the robot cameras match the policy cameras"}
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def environment_dt(self) -> float:
|
def environment_dt(self) -> float:
|
||||||
"""Environment time step, in seconds"""
|
"""Environment time step, in seconds"""
|
||||||
|
|||||||
@@ -62,15 +62,6 @@ def visualize_action_queue_size(action_queue_size: list[int]) -> None:
|
|||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
def validate_robot_cameras_for_policy(
|
|
||||||
lerobot_observation_features: dict[str, dict], policy_image_features: dict[str, PolicyFeature]
|
|
||||||
) -> None:
|
|
||||||
image_keys = list(filter(is_image_key, lerobot_observation_features))
|
|
||||||
assert set(image_keys) == set(policy_image_features.keys()), (
|
|
||||||
f"Policy image features must match robot cameras! Received {list(policy_image_features.keys())} != {image_keys}"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def map_robot_keys_to_lerobot_features(robot: Robot) -> dict[str, dict]:
|
def map_robot_keys_to_lerobot_features(robot: Robot) -> dict[str, dict]:
|
||||||
return hw_to_dataset_features(robot.observation_features, OBS_STR, use_video=False)
|
return hw_to_dataset_features(robot.observation_features, OBS_STR, use_video=False)
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import torch
|
|||||||
|
|
||||||
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401
|
from lerobot.cameras.opencv.configuration_opencv import OpenCVCameraConfig # noqa: F401
|
||||||
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401
|
from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraConfig # noqa: F401
|
||||||
from lerobot.configs.policies import PreTrainedConfig
|
|
||||||
from lerobot.robots import ( # noqa: F401
|
from lerobot.robots import ( # noqa: F401
|
||||||
Robot,
|
Robot,
|
||||||
RobotConfig,
|
RobotConfig,
|
||||||
@@ -76,7 +75,6 @@ from .helpers import (
|
|||||||
TimedObservation,
|
TimedObservation,
|
||||||
get_logger,
|
get_logger,
|
||||||
map_robot_keys_to_lerobot_features,
|
map_robot_keys_to_lerobot_features,
|
||||||
validate_robot_cameras_for_policy,
|
|
||||||
visualize_action_queue_size,
|
visualize_action_queue_size,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -98,14 +96,6 @@ class RobotClient:
|
|||||||
|
|
||||||
lerobot_features = map_robot_keys_to_lerobot_features(self.robot)
|
lerobot_features = map_robot_keys_to_lerobot_features(self.robot)
|
||||||
|
|
||||||
if config.verify_robot_cameras:
|
|
||||||
# Load policy config for validation
|
|
||||||
policy_config = PreTrainedConfig.from_pretrained(config.pretrained_name_or_path)
|
|
||||||
policy_image_features = policy_config.image_features
|
|
||||||
|
|
||||||
# The cameras specified for inference must match the one supported by the policy chosen
|
|
||||||
validate_robot_cameras_for_policy(lerobot_features, policy_image_features)
|
|
||||||
|
|
||||||
# Use environment variable if server_address is not provided in config
|
# Use environment variable if server_address is not provided in config
|
||||||
self.server_address = config.server_address
|
self.server_address = config.server_address
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ def test_async_inference_e2e(monkeypatch):
|
|||||||
policy_type="test",
|
policy_type="test",
|
||||||
pretrained_name_or_path="test",
|
pretrained_name_or_path="test",
|
||||||
actions_per_chunk=20,
|
actions_per_chunk=20,
|
||||||
verify_robot_cameras=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
client = RobotClient(client_config)
|
client = RobotClient(client_config)
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ def robot_client():
|
|||||||
policy_type="test",
|
policy_type="test",
|
||||||
pretrained_name_or_path="test",
|
pretrained_name_or_path="test",
|
||||||
actions_per_chunk=20,
|
actions_per_chunk=20,
|
||||||
verify_robot_cameras=False,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
client = RobotClient(test_config)
|
client = RobotClient(test_config)
|
||||||
|
|||||||
Reference in New Issue
Block a user