chore(rollout): address coments + minor improvements

This commit is contained in:
Steven Palma
2026-04-22 16:37:19 +02:00
parent d70c3baf7c
commit 4499519dbf
10 changed files with 30 additions and 32 deletions
+2 -2
View File
@@ -108,7 +108,7 @@ lerobot-rollout --strategy.type=dagger \
--teleop.port_left=/dev/ttyACM0 \ --teleop.port_left=/dev/ttyACM0 \
--teleop.port_right=/dev/ttyACM1 \ --teleop.port_right=/dev/ttyACM1 \
--policy.path=outputs/pretrain/checkpoints/last/pretrained_model \ --policy.path=outputs/pretrain/checkpoints/last/pretrained_model \
--dataset.repo_id=your-username/hil-dataset \ --dataset.repo_id=your-username/rollout_hil_dataset \
--dataset.single_task="Fold the T-shirt properly" \ --dataset.single_task="Fold the T-shirt properly" \
--dataset.fps=30 \ --dataset.fps=30 \
--strategy.num_episodes=50 \ --strategy.num_episodes=50 \
@@ -135,7 +135,7 @@ lerobot-rollout --strategy.type=dagger \
--teleop.port_left=/dev/ttyACM0 \ --teleop.port_left=/dev/ttyACM0 \
--teleop.port_right=/dev/ttyACM1 \ --teleop.port_right=/dev/ttyACM1 \
--policy.path=outputs/pretrain/checkpoints/last/pretrained_model \ --policy.path=outputs/pretrain/checkpoints/last/pretrained_model \
--dataset.repo_id=your-username/hil-rtc-dataset \ --dataset.repo_id=your-username/rollout_hil_rtc_dataset \
--dataset.single_task="Fold the T-shirt properly" \ --dataset.single_task="Fold the T-shirt properly" \
--dataset.fps=30 \ --dataset.fps=30 \
--strategy.num_episodes=50 \ --strategy.num_episodes=50 \
+4 -4
View File
@@ -59,7 +59,7 @@ lerobot-rollout \
--robot.type=so100_follower \ --robot.type=so100_follower \
--robot.port=/dev/ttyACM0 \ --robot.port=/dev/ttyACM0 \
--robot.cameras="{ front: {type: opencv, index_or_path: 0, width: 640, height: 480, fps: 30}}" \ --robot.cameras="{ front: {type: opencv, index_or_path: 0, width: 640, height: 480, fps: 30}}" \
--dataset.repo_id=${HF_USER}/eval_data \ --dataset.repo_id=${HF_USER}/rollout_eval_data \
--dataset.single_task="Put lego brick into the box" \ --dataset.single_task="Put lego brick into the box" \
--duration=3600 --duration=3600
``` ```
@@ -84,7 +84,7 @@ lerobot-rollout \
--policy.path=${HF_USER}/my_policy \ --policy.path=${HF_USER}/my_policy \
--robot.type=koch_follower \ --robot.type=koch_follower \
--robot.port=/dev/ttyACM0 \ --robot.port=/dev/ttyACM0 \
--dataset.repo_id=${HF_USER}/highlight_data \ --dataset.repo_id=${HF_USER}/rollout_highlight_data \
--dataset.single_task="Pick up the red cube" --dataset.single_task="Pick up the red cube"
``` ```
@@ -118,7 +118,7 @@ lerobot-rollout \
--policy.path=outputs/pretrain/checkpoints/last/pretrained_model \ --policy.path=outputs/pretrain/checkpoints/last/pretrained_model \
--robot.type=bi_openarm_follower \ --robot.type=bi_openarm_follower \
--teleop.type=openarm_mini \ --teleop.type=openarm_mini \
--dataset.repo_id=${HF_USER}/hil_data \ --dataset.repo_id=${HF_USER}/rollout_hil_data \
--dataset.single_task="Fold the T-shirt" --dataset.single_task="Fold the T-shirt"
``` ```
@@ -134,7 +134,7 @@ lerobot-rollout \
--robot.port=/dev/ttyACM0 \ --robot.port=/dev/ttyACM0 \
--teleop.type=so101_leader \ --teleop.type=so101_leader \
--teleop.port=/dev/ttyACM1 \ --teleop.port=/dev/ttyACM1 \
--dataset.repo_id=${HF_USER}/dagger_data \ --dataset.repo_id=${HF_USER}/rollout_dagger_data \
--dataset.single_task="Grasp the block" --dataset.single_task="Grasp the block"
``` ```
+5 -5
View File
@@ -136,11 +136,11 @@ class DAggerStrategyConfig(RolloutStrategyConfig):
2. **correction** — toggle human correction recording. 2. **correction** — toggle human correction recording.
3. **upload** — push dataset to hub on demand (corrections-only mode). 3. **upload** — push dataset to hub on demand (corrections-only mode).
When ``record_autonomous=True`` (default) both autonomous and correction When ``record_autonomous=False`` (default) only human-correction windows
frames are recorded with size-based episode rotation (same as Sentry) are recorded — each correction becomes its own episode. Set to ``True``
and background uploading. ``push_to_hub`` is blocked while a correction to record both autonomous and correction frames with size-based episode
is in progress. Set to ``False`` to record only the human-correction rotation (same as Sentry) and background uploading. ``push_to_hub`` is
windows, where each correction becomes its own episode. blocked while a correction is in progress.
""" """
# Number of correction episodes to collect (corrections-only mode). # Number of correction episodes to collect (corrections-only mode).
+3 -2
View File
@@ -346,10 +346,11 @@ def build_rollout_context(
"names": None, "names": None,
} }
if not cfg.dataset.repo_id.startswith("rollout_"): repo_name = cfg.dataset.repo_id.split("/", 1)[-1]
if not repo_name.startswith("rollout_"):
raise ValueError( raise ValueError(
"Dataset names for rollout must start with 'rollout_'. " "Dataset names for rollout must start with 'rollout_'. "
"Use --dataset.repo_id=rollout_<name> for policy deployment datasets." "Use --dataset.repo_id=<user>/rollout_<name> for policy deployment datasets."
) )
cfg.dataset.stamp_repo_id() cfg.dataset.stamp_repo_id()
dataset = LeRobotDataset.create( dataset = LeRobotDataset.create(
+4 -4
View File
@@ -68,10 +68,10 @@ class SyncInferenceConfig(InferenceEngineConfig):
class RTCInferenceConfig(InferenceEngineConfig): class RTCInferenceConfig(InferenceEngineConfig):
"""Real-Time Chunking: async policy inference in a background thread.""" """Real-Time Chunking: async policy inference in a background thread."""
# ``RTCConfig`` is a small dataclass with default-only fields, so eagerly # Selecting ``--inference.type=rtc`` means the user wants RTC, so
# constructing one here costs nothing and keeps draccus' CLI surface flat # ``enabled`` defaults to True here (unlike the policy-side RTCConfig
# (``--inference.rtc.execution_horizon=...`` etc.). No need to lazy-init. # which defaults to False for the ``rtc_config: RTCConfig | None`` path).
rtc: RTCConfig = field(default_factory=RTCConfig) rtc: RTCConfig = field(default_factory=lambda: RTCConfig(enabled=True))
queue_threshold: int = 30 queue_threshold: int = 30
+1 -1
View File
@@ -73,7 +73,7 @@ class BaseStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0: if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t) precise_sleep(sleep_t)
else: else:
logging.warning( logger.warning(
f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation" f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation"
) )
+2 -2
View File
@@ -509,7 +509,7 @@ class DAggerStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0: if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t) precise_sleep(sleep_t)
else: else:
logging.warning( logger.warning(
f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation" f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation"
) )
@@ -653,7 +653,7 @@ class DAggerStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0: if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t) precise_sleep(sleep_t)
else: else:
logging.warning( logger.warning(
f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation" f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation"
) )
+3 -6
View File
@@ -152,11 +152,7 @@ class HighlightStrategy(RolloutStrategy):
# NOTE: ``is_set()`` then ``clear()`` is not atomic # NOTE: ``is_set()`` then ``clear()`` is not atomic
# against the keyboard thread setting the flag again # against the keyboard thread setting the flag again
# in between — but that is benign: we lose at most one # in between — but that is benign: we lose at most one
# toggle, processed on the next iteration. The # toggle, processed on the next iteration.
# ``_recording_live`` branch below is reached in the
# SAME iteration after ``clear()`` runs, so a frame
# finalised by ``save_episode()`` is never re-added to
# the next episode.
if self._save_requested.is_set(): if self._save_requested.is_set():
self._save_requested.clear() self._save_requested.clear()
if not self._recording_live.is_set(): if not self._recording_live.is_set():
@@ -177,6 +173,7 @@ class HighlightStrategy(RolloutStrategy):
play_sounds, play_sounds,
) )
self._recording_live.clear() self._recording_live.clear()
continue # frame already consumed — skip ring.append
if self._push_requested.is_set(): if self._push_requested.is_set():
self._push_requested.clear() self._push_requested.clear()
@@ -192,7 +189,7 @@ class HighlightStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0: if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t) precise_sleep(sleep_t)
else: else:
logging.warning( logger.warning(
f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation" f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation"
) )
+1 -1
View File
@@ -161,7 +161,7 @@ class SentryStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0: if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t) precise_sleep(sleep_t)
else: else:
logging.warning( logger.warning(
f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation" f"Record loop is running slower ({1 / dt:.1f} Hz) than the target FPS ({cfg.fps} Hz). Dataset frames might be dropped and robot control might be unstable. Common causes are: 1) Camera FPS not keeping up 2) Policy inference taking too long 3) CPU starvation"
) )
+5 -5
View File
@@ -63,7 +63,7 @@ Usage examples
--inference.type=rtc \\ --inference.type=rtc \\
--robot.type=so100_follower \\ --robot.type=so100_follower \\
--robot.port=/dev/ttyACM0 \\ --robot.port=/dev/ttyACM0 \\
--dataset.repo_id=user/sentry-data \\ --dataset.repo_id=user/rollout_sentry_data \\
--dataset.single_task="patrol" --duration=3600 --dataset.single_task="patrol" --duration=3600
# Highlight mode — ring buffer, press 's' to save, 'h' to push # Highlight mode — ring buffer, press 's' to save, 'h' to push
@@ -73,7 +73,7 @@ Usage examples
--policy.path=lerobot/act_koch_real \\ --policy.path=lerobot/act_koch_real \\
--robot.type=koch_follower \\ --robot.type=koch_follower \\
--robot.port=/dev/ttyACM0 \\ --robot.port=/dev/ttyACM0 \\
--dataset.repo_id=user/highlight-data \\ --dataset.repo_id=user/rollout_highlight_data \\
--dataset.single_task="pick up cube" --dataset.single_task="pick up cube"
# DAgger mode — human-in-the-loop corrections only # DAgger mode — human-in-the-loop corrections only
@@ -83,7 +83,7 @@ Usage examples
--policy.path=outputs/pretrain/checkpoints/last/pretrained_model \\ --policy.path=outputs/pretrain/checkpoints/last/pretrained_model \\
--robot.type=bi_openarm_follower \\ --robot.type=bi_openarm_follower \\
--teleop.type=openarm_mini \\ --teleop.type=openarm_mini \\
--dataset.repo_id=user/hil-data \\ --dataset.repo_id=user/rollout_hil_data \\
--dataset.single_task="Fold the T-shirt" --dataset.single_task="Fold the T-shirt"
# DAgger mode — continuous recording with RTC inference # DAgger mode — continuous recording with RTC inference
@@ -98,7 +98,7 @@ Usage examples
--robot.port=/dev/ttyACM0 \\ --robot.port=/dev/ttyACM0 \\
--teleop.type=so101_leader \\ --teleop.type=so101_leader \\
--teleop.port=/dev/ttyACM1 \\ --teleop.port=/dev/ttyACM1 \\
--dataset.repo_id=user/dagger-rtc-data \\ --dataset.repo_id=user/rollout_dagger_rtc_data \\
--dataset.single_task="Grasp the block" --dataset.single_task="Grasp the block"
# With Rerun visualization and torch.compile # With Rerun visualization and torch.compile
@@ -117,7 +117,7 @@ Usage examples
--policy.path=user/my_policy \\ --policy.path=user/my_policy \\
--robot.type=so100_follower \\ --robot.type=so100_follower \\
--robot.port=/dev/ttyACM0 \\ --robot.port=/dev/ttyACM0 \\
--dataset.repo_id=user/sentry-data \\ --dataset.repo_id=user/rollout_sentry_data \\
--dataset.single_task="patrol" \\ --dataset.single_task="patrol" \\
--resume=true --resume=true
""" """