perf(data): parallelize NeMo Gym image encoding - #3721
Merged
Conversation
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
youngeunkwon0405
marked this pull request as ready for review
August 20, 2026 01:22
Contributor
Author
|
/ok to test 6957387 |
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Contributor
Author
|
/ok to test 634f545 |
aroshanghias-nvd
left a comment
Contributor
There was a problem hiding this comment.
One non-blocking operational concern:
This was referenced Aug 20, 2026
Signed-off-by: Youngeun Kwon <youngeunk@nvidia.com>
Contributor
Author
|
/ok to test 462ff92 |
Contributor
|
@yfw @terrykong can we merge this? It is a harmless optimization for image encoding. |
Contributor
Author
|
Hi @terrykong, can I get your help with merging this PR? It is a ~20-line logic change that parallelizes image encoding for the VLM models. I already did it through |
terrykong
approved these changes
Aug 24, 2026
terrykong
enabled auto-merge (squash)
August 24, 2026 19:04
4 tasks
yfw
pushed a commit
that referenced
this pull request
Aug 27, 2026
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.
What does this PR do?
Parallelizes local-image conversion in
encode_images_in_exampleswithout changing its public API or supported payload shapes.The function now:
ThreadPoolExecutor(max_workers=8);The worker count is capped at eight to bound peak decoded-image memory. In a CPU microbenchmark using 1024 x 1024 PNGs, the thread pool provided approximately 3.7-3.9x speedup. Deduplication is a separate gain: GRPO repeats each prompt per generation, so a group size of
Npreviously encoded the same image approximatelyNtimes and now encodes it once.HTTP(S) and existing
data:URLs remain pass-through values, and local paths plusfile://URLs keep the existing PNG data-URL behavior.Issues
None.
Validation
uvx --from ruff==0.9.9 ruff check nemo_rl/data/multimodal_utils.py tests/unit/data/test_multimodal_image_encoding.pyuvx --from ruff==0.9.9 ruff format --check nemo_rl/data/multimodal_utils.py tests/unit/data/test_multimodal_image_encoding.pyuv run --extra nemo_gym --group test pytest -q --noconftest tests/unit/data/test_multimodal_image_encoding.py- 7 passed on the initial patchLint checkon634f5450fecf30ba09c6495261586e01ec370ee2- passed, including PyreflyBefore your PR is "Ready for review"