Skip to content

fix(megatron): preserve patchified vision tensors - #4212

Merged
terrykong merged 1 commit into
NVIDIA-NeMo:mainfrom
rohitrango:rohit/fix-megatron-patchified-generation
Sep 19, 2026
Merged

terrykong merged 1 commit into
NVIDIA-NeMo:mainfrom
rohitrango:rohit/fix-megatron-patchified-generation

Conversation

@rohitrango

Copy link
Copy Markdown
Contributor

What

  • preserve already-patchified vision tensors when building Megatron generation requests
  • add regression coverage for raw RGB and patchified tensor shapes

Why

Patchified inputs have shape [1, total_patches, 3 * patch_dim**2]. Adding a batch dimension made Megatron interpret them as one-channel raw images, producing 256-wide patches for a vision tower that expects 768-wide RGB patches.

Testing

  • uv run --no-sync --extra mcore pytest -q --mcore-only tests/unit/models/generation/test_megatron_generation.py -k sample_vision_tensors_preserves_patchified_shape (2 passed)
  • tests/functional/nemotron_omni_clevr_megatron_single_controller_1n2g.sh: generation requests complete and the original 1024x256 and 768x1280 failure is gone; the 2-GPU run later reaches optimizer step and exhausts GPU memory while allocating optimizer state
  • pre-commit: formatting, Ruff, and repository checks pass; local pyrefly was blocked by the private Automodel submodule pin in the standalone worktree

@rohitrango
rohitrango requested review from a team as code owners September 19, 2026 17:30
@copy-pr-bot

copy-pr-bot Bot commented Sep 19, 2026

Copy link
Copy Markdown

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rohitrango rohitrango added the CI:L1 Run doctests, unit tests, and functional tests label Sep 19, 2026
@rohitrango

Copy link
Copy Markdown
Contributor Author

/ok to test b6076be

@terrykong
terrykong enabled auto-merge (squash) September 19, 2026 17:38
@terrykong
terrykong merged commit 880a37a into NVIDIA-NeMo:main Sep 19, 2026
184 of 188 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L1 Run doctests, unit tests, and functional tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants