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
+5 -5
View File
@@ -136,11 +136,11 @@ class DAggerStrategyConfig(RolloutStrategyConfig):
2. **correction** — toggle human correction recording.
3. **upload** — push dataset to hub on demand (corrections-only mode).
When ``record_autonomous=True`` (default) both autonomous and correction
frames are recorded with size-based episode rotation (same as Sentry)
and background uploading. ``push_to_hub`` is blocked while a correction
is in progress. Set to ``False`` to record only the human-correction
windows, where each correction becomes its own episode.
When ``record_autonomous=False`` (default) only human-correction windows
are recorded — each correction becomes its own episode. Set to ``True``
to record both autonomous and correction frames with size-based episode
rotation (same as Sentry) and background uploading. ``push_to_hub`` is
blocked while a correction is in progress.
"""
# Number of correction episodes to collect (corrections-only mode).
+3 -2
View File
@@ -346,10 +346,11 @@ def build_rollout_context(
"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(
"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()
dataset = LeRobotDataset.create(
+4 -4
View File
@@ -68,10 +68,10 @@ class SyncInferenceConfig(InferenceEngineConfig):
class RTCInferenceConfig(InferenceEngineConfig):
"""Real-Time Chunking: async policy inference in a background thread."""
# ``RTCConfig`` is a small dataclass with default-only fields, so eagerly
# constructing one here costs nothing and keeps draccus' CLI surface flat
# (``--inference.rtc.execution_horizon=...`` etc.). No need to lazy-init.
rtc: RTCConfig = field(default_factory=RTCConfig)
# Selecting ``--inference.type=rtc`` means the user wants RTC, so
# ``enabled`` defaults to True here (unlike the policy-side RTCConfig
# which defaults to False for the ``rtc_config: RTCConfig | None`` path).
rtc: RTCConfig = field(default_factory=lambda: RTCConfig(enabled=True))
queue_threshold: int = 30
+1 -1
View File
@@ -73,7 +73,7 @@ class BaseStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t)
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"
)
+2 -2
View File
@@ -509,7 +509,7 @@ class DAggerStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t)
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"
)
@@ -653,7 +653,7 @@ class DAggerStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t)
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"
)
+3 -6
View File
@@ -152,11 +152,7 @@ class HighlightStrategy(RolloutStrategy):
# NOTE: ``is_set()`` then ``clear()`` is not atomic
# against the keyboard thread setting the flag again
# in between — but that is benign: we lose at most one
# toggle, processed on the next iteration. The
# ``_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.
# toggle, processed on the next iteration.
if self._save_requested.is_set():
self._save_requested.clear()
if not self._recording_live.is_set():
@@ -177,6 +173,7 @@ class HighlightStrategy(RolloutStrategy):
play_sounds,
)
self._recording_live.clear()
continue # frame already consumed — skip ring.append
if self._push_requested.is_set():
self._push_requested.clear()
@@ -192,7 +189,7 @@ class HighlightStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t)
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"
)
+1 -1
View File
@@ -161,7 +161,7 @@ class SentryStrategy(RolloutStrategy):
if (sleep_t := control_interval - dt) > 0:
precise_sleep(sleep_t)
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"
)
+5 -5
View File
@@ -63,7 +63,7 @@ Usage examples
--inference.type=rtc \\
--robot.type=so100_follower \\
--robot.port=/dev/ttyACM0 \\
--dataset.repo_id=user/sentry-data \\
--dataset.repo_id=user/rollout_sentry_data \\
--dataset.single_task="patrol" --duration=3600
# Highlight mode — ring buffer, press 's' to save, 'h' to push
@@ -73,7 +73,7 @@ Usage examples
--policy.path=lerobot/act_koch_real \\
--robot.type=koch_follower \\
--robot.port=/dev/ttyACM0 \\
--dataset.repo_id=user/highlight-data \\
--dataset.repo_id=user/rollout_highlight_data \\
--dataset.single_task="pick up cube"
# DAgger mode — human-in-the-loop corrections only
@@ -83,7 +83,7 @@ Usage examples
--policy.path=outputs/pretrain/checkpoints/last/pretrained_model \\
--robot.type=bi_openarm_follower \\
--teleop.type=openarm_mini \\
--dataset.repo_id=user/hil-data \\
--dataset.repo_id=user/rollout_hil_data \\
--dataset.single_task="Fold the T-shirt"
# DAgger mode — continuous recording with RTC inference
@@ -98,7 +98,7 @@ Usage examples
--robot.port=/dev/ttyACM0 \\
--teleop.type=so101_leader \\
--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"
# With Rerun visualization and torch.compile
@@ -117,7 +117,7 @@ Usage examples
--policy.path=user/my_policy \\
--robot.type=so100_follower \\
--robot.port=/dev/ttyACM0 \\
--dataset.repo_id=user/sentry-data \\
--dataset.repo_id=user/rollout_sentry_data \\
--dataset.single_task="patrol" \\
--resume=true
"""