Improve async LeRobot persistence throughput and memory bounds - #730
Conversation
|
|
Addressed the review findings and the failing CI tests in commit
Validation:
|
1 similar comment
|
Addressed the review findings and the failing CI tests in commit
Validation:
|
|
Follow-up fixes are now pushed to
Local validation now passes:
|
|
The CI still exposed the editable-install variant where task modules were imported before entry-point discovery as Local validation with the preloaded nested package scenario now passes the official task-layout test. The combined targeted suite passes 99 tests:
|
|
CI’s previous test job stayed in progress after the nested-module normalization. I narrowed that fix: it now aliases the already-loaded module and updates registered class The local combined targeted suite passes 139 tests, including the preloaded nested-package official-layout scenario. The previous run was canceled to avoid leaving a stale long-running job; the push triggers a fresh CI run. |
|
Root cause of the remaining CI failure was the new demo test importing the repository container path (
Validation:
|
Description
This PR improves offline LeRobot persistence for long parallel-environment collections.
It adds an optional bounded
AsyncLeRobotRecorderpayload queue with queue depth and producer backpressure metrics, and an optional lossless PNGimage_compress_levelfrom 0 to 9. Existing defaults remain unchanged: the queue is unbounded whenasync_queue_maxsize=0, and LeRobot image compression remains level 6 unless explicitly configured.The data-pipeline context documents the new queue behavior and memory tradeoff.
Validation
python -m pytest -q tests/gym/envs/managers/test_async_dataset_functors.py tests/gym/envs/managers/test_dataset_functors.py— 87 passed.python docs/scripts/check_api_docs.py— 2387/2387 exports documented.python -m black .— 1171 files unchanged.async_queue_maxsize=1and PNG level 1; queue drained to zero.100-trajectory comparison
Same task and hardware in separate worktrees:
StayStillSave-v1, 4 environments, 100 trajectories × 100 frames, 320×240 RGB, 8 image-writer threads, Python 3.11, DexSim 0.5.0, LeRobot 0.4.4.origin/main, default image compressionThe bounded configuration reduced end-to-end time by 29.28 s (29.6%) versus main while keeping the queue peak at 8. The unbounded configuration was only 0.96 s faster but reached queue depth 74, so the bounded setting is the safer production choice.
Validation read every Parquet row, checked 100 episode sidecar entries of length 100, decoded all 10,000 RGB images, and verified 10,000 rows of finite action/state data. Numeric hashes matched across runs; rendered image hashes differed because each isolated simulator run produced different camera pixels.
Type of change
Dependencies
No new dependencies.
The three-camera demo task is included as a benchmark configuration and registered Gym task.
Checklist
black .command to format the code base.Standard three-camera demo
The PR now includes
StayStillSave3Cam-v1: three 640×480 RGB cameras, one 300-step stationary segment, and a catalog/config entry with the candidate optimized defaults (AsyncLeRobotRecorder, 8 image-writer threads, PNG level 1, queue max 8).Single-episode measurements (300 frames and 900 decoded RGB images):
All three runs produced one 300-frame episode and passed image shape, Parquet row, and sidecar-length validation.
16-environment / 100-trajectory validation
Using
StayStillSave3Cam-v1with 16 parallel environments, 100 trajectories, 300 steps per trajectory, three 640×480 cameras, and the candidate defaults (level=1, 8 writer threads, queue max 8):completed=true,truncated=false, and accepted segments; 90,000 image entries were non-empty and 900 sampled RGB images decoded with shape 480×640×3 across all three cameras