Repository navigation
perf(rl): add opt-in CUDA image preprocessing for HIL-SERL - #4916
Draft
Han-Shen-math wants to merge 1 commit into
Draft
Han-Shen-math wants to merge 1 commit into
Han-Shen-math wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / Motivation
The HIL-SERL observation pipeline converts and normalizes camera frames on CPU, then transfers float32 images after crop/resize. This adds an opt-in
image_devicesetting: transfer uint8 frames to the selected device first, then convert layout and normalize there. The real-robot pipeline's existing crop/resize step follows the image device. CPU remains the default.Related issues
What changed
env.processor.image_preprocessing.image_deviceand pass it to both the real-robot andgym_hilobservation processors.How was this tested (or how to run locally)
On macOS arm64, Python 3.12.14, PyTorch 2.11.0:
39 passed, 3 skipped because CUDA is unavailable. This covers unchanged CPU outputs, saved/legacy configs, both factory branches, CPU crop/resize, and the existing MPS crop/resize fallback. CUDA tests are included for image placement, CPU state placement and crop/resize parity, but were not executed locally.
All applicable pre-commit hooks passed on the six changed files, including mypy. No training, CUDA performance benchmark, or robot rollout was run.
To try on a CUDA machine, set this field in an existing HIL-SERL environment config:
{ "env": { "processor": { "image_preprocessing": { "image_device": "cuda" } } } }Keep the other environment settings and use the same CUDA device as the policy/final processor. Measure after warmup and synchronize CUDA before and after timing. This PR makes no measured speedup or control-frequency claim.
Checklist
Reviewer notes
Draft pending real CUDA validation and maintainer feedback on the configuration/API. Implemented and reviewed with significant Codex assistance.