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:
|
| sys.modules.setdefault(flat_name, module) | ||
| module.__name__ = flat_name | ||
| module.__package__ = flat_name.rpartition(".")[0] | ||
| spec.cls.__module__ = flat_name |
There was a problem hiding this comment.
Registered class points elsewhere If a task module is imported under its nested name before discovery, discovery can also load a distinct module under the flat name.
setdefault keeps that flat module, but this code still changes the registered class’s __module__ to point to it. The resulting Gym entry point identifies a different class, and serialization of the registered class can fail because the class at that path is not the same object. Only change the class path when the flat name resolves to that class.
Prompt To Fix With AI
This is a comment left during a code review.
Path: embodichain/lab/gym/utils/registration.py
Line: 481-484
Comment:
**Registered class points elsewhere** If a task module is imported under its nested name before discovery, discovery can also load a distinct module under the flat name. `setdefault` keeps that flat module, but this code still changes the registered class’s `__module__` to point to it. The resulting Gym entry point identifies a different class, and serialization of the registered class can fail because the class at that path is not the same object. Only change the class path when the flat name resolves to that class.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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