diff --git a/lerobot/common/datasets/lerobot_dataset.py b/lerobot/common/datasets/lerobot_dataset.py index 817ab39f8..425e9f7e7 100644 --- a/lerobot/common/datasets/lerobot_dataset.py +++ b/lerobot/common/datasets/lerobot_dataset.py @@ -38,6 +38,7 @@ from lerobot.common.datasets.utils import ( DEFAULT_IMAGE_PATH, INFO_PATH, TASKS_PATH, + _validate_feature_names, append_jsonlines, backward_compatible_episodes_stats, check_delta_timestamps, @@ -314,23 +315,9 @@ class LeRobotDatasetMetadata: obj.root.mkdir(parents=True, exist_ok=False) - # if robot is not None: - # features = get_features_from_robot(robot, use_videos) - # robot_type = robot.robot_type - # if not all(cam.fps == fps for cam in robot.cameras.values()): - # logging.warning( - # f"Some cameras in your {robot.robot_type} robot don't have an fps matching the fps of your dataset." - # "In this case, frames from lower fps cameras will be repeated to fill in the blanks." - # ) - # TODO(aliberts, rcadene): implement sanity check for features features = {**features, **DEFAULT_FEATURES} - - # check if none of the features contains a "/" in their names, - # as this would break the dict flattening in the stats computation, which uses '/' as separator - for key in features: - if "/" in key: - raise ValueError(f"Feature names should not contain '/'. Found '/' in feature '{key}'.") + _validate_feature_names(features) obj.tasks, obj.task_to_task_index = {}, {} obj.episodes_stats, obj.stats, obj.episodes = {}, {}, {} diff --git a/lerobot/record.py b/lerobot/record.py index afffe56cd..d65383a13 100644 --- a/lerobot/record.py +++ b/lerobot/record.py @@ -243,10 +243,6 @@ def record(cfg: RecordConfig) -> LeRobotDataset: cfg.dataset.repo_id, root=cfg.dataset.root, ) - # for key, ft in dataset_features.items(): - # for property in ["dtype", "shape", "names"]: - # if ft[property] != dataset.features[key][property]: - # raise ValueError(ft) if hasattr(robot, "cameras") and len(robot.cameras) > 0: dataset.start_image_writer( @@ -277,22 +273,6 @@ def record(cfg: RecordConfig) -> LeRobotDataset: listener, events = init_keyboard_listener() - # Execute a few seconds without recording to: - # 1. teleoperate the robot to move it in starting position if no policy provided, - # 2. give times to the robot devices to connect and start synchronizing, - # 3. place the cameras windows on screen - # enable_teleoperation = policy is None - # log_say("Warmup record", cfg.play_sounds) - # record_loop( - # robot=robot, - # control_time_s=cfg.warmup_time_s, - # display_data=cfg.display_data, - # events=events, - # fps=cfg.dataset.fps, - # teleoperate=enable_teleoperation, - # ) - # warmup_record(robot, events, enable_teleoperation, cfg.warmup_time_s, cfg.display_data, cfg.dataset.fps) - for recorded_episodes in range(cfg.dataset.num_episodes): log_say(f"Recording episode {dataset.num_episodes}", cfg.play_sounds) record_loop(