[data] fix: Support Energon 7 metadata and stateless cookers#4090
Conversation
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
Energon's get_stateless(cooker.cook) check fires per-sample and aborts the run with 'AssertionError: Cooker must be stateless'. The three diffusion cook functions (wan, flux, common SP base) are pure dict reshapes, so wrap them with @stateless to satisfy the contract. Signed-off-by: oliver könig <okoenig@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
| keys = [s.__key__ for s in samples] | ||
| batch_kwargs: Dict = dict( | ||
| **batch_metadata_kwargs(keys=keys), | ||
| __keys__=[s.__key__ for s in samples], |
There was a problem hiding this comment.
Nit: keys is already computed on the line above but __keys__ re-creates the same list. The other two callers (nemotron_omni_task_encoder.py and qwen_vl/task_encoder.py) reuse the variable. Suggest:
| __keys__=[s.__key__ for s in samples], | |
| __keys__=keys, |
|
Review — Light Clean fix: @stateless on the three diffusion cook functions resolves the Energon 7 assertion, and the new metadata.py compatibility layer centralizes the Energon 6/7 field differences nicely. Observations
Suggested test cases No perf tests impacted. |
|
/ok to test 96bd844 |
Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com>
|
/ok to test 37dac61 |
…NeMo#4090) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: yaoyu-33 <yaoyu.094@gmail.com> Signed-off-by: oliver könig <okoenig@nvidia.com> Co-authored-by: dimapihtar <37850217+dimapihtar@users.noreply.github.com> Co-authored-by: yaoyu-33 <yaoyu.094@gmail.com> Signed-off-by: Vasudevan Rengasamy <vrengasamy@nvidia.com>
Summary
52d1d681d6000e5da867b9b100c14648e4f85de9and updatesuv.lock, including the move tomegatron-energon 7.3.2.Cooker.cookfunctions@statelessfor the Energon 7 cooker contract.Original Bump
uv.lock(main, mcore-main) (2026-05-30) #4087main52d1d681d6000e5da867b9b100c14648e4f85de9updates the MCore Energon requirement from~=6.0to~=7.0, and the bump lockfile movesmegatron-energonfrom6.0.1to7.3.2. Energon 7 removes the singular sample__subflavor__field, requires batch__key__/__restore_key__metadata, and asserts cooker functions are stateless.src/megatron/bridge/data/energon/metadata.pywith TODO removal condition: remove when Bridge no longer supportsmegatron-energon 6.x. Removed stale guards: none.Validation
uv run pre-commit run --all-files- passed.uv run python -m pytest tests/unit_tests/data/energon/test_hf_encoder_task_encoder.py tests/unit_tests/data/energon/test_nemotron_omni_task_encoder.py tests/unit_tests/recipes/qwen_vl/data/energon/test_task_encoder.py tests/unit_tests/diffusion/data/common/test_diffusion_sample.py tests/unit_tests/diffusion/data/common/test_diffusion_task_encoder.py tests/unit_tests/diffusion/data/flux/test_flux_taskencoder.py tests/unit_tests/diffusion/data/wan/test_wan_taskencoder.py tests/unit_tests/models/nemotron_omni/test_nemotron_omni_conversion.py -q- passed, 59 passed, 32 warnings in 1.24s.uvx ruff check/uvx ruff format --checkon the three diffusion files - clean.