Skip to content

fix(packaging): AUT-1323 include megatron.post_training in package disco - #6290

Closed
svcnemo-autobot wants to merge 2 commits into
NVIDIA:mainfrom
svcnemo-autobot:fix/post-training-package
Closed

fix(packaging): AUT-1323 include megatron.post_training in package disco#6290
svcnemo-autobot wants to merge 2 commits into
NVIDIA:mainfrom
svcnemo-autobot:fix/post-training-package

Conversation

@svcnemo-autobot

@svcnemo-autobot svcnemo-autobot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Background

Commit bf71c14 added megatron/post_training/ but did not add it to pyproject.toml's [tool.setuptools.packages.find] include list. This causes ModuleNotFoundError: No module named 'megatron.post_training' when megatron.training imports from it. Additionally, megatron/post_training/utils.py eagerly imported modelopt at module level, breaking imports without ModelOpt installed.

What changed

  • Add megatron.post_training and megatron.post_training.* to the [tool.setuptools.packages.find] include list.
  • Move modelopt, modelopt.torch.quantization, and is_quantized imports into the functions that use them so the module is importable without modelopt.

Details

flowchart LR
    A[bf71c14 adds post_training/] --> B[pyproject.toml missing entry]
    B --> C[ModuleNotFoundError on import]
    C --> D[Add to packages.find + guard modelopt]
    D --> E[Module packaged and importable without modelopt]
Loading

Tested

  • python3 -m build produces wheel with 19 post_training entries
  • pip install --no-deps + import megatron.post_training succeeds
  • import megatron.post_training.utils and megatron.post_training.checkpointing succeed without modelopt installed

@copy-pr-bot

copy-pr-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@svcnvidia-nemo-ci
svcnvidia-nemo-ci marked this pull request as draft August 5, 2026 19:35
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test 16c8a9f

Commit bf71c14 added megatron/post_training/ but did not add it to
pyproject.toml's [tool.setuptools.packages.find] include list. This
causes ModuleNotFoundError when megatron.training imports from
megatron.post_training (e.g. checkpointing.py imports
print_distributed_quant_summary and maybe_enable_modelopt).

Add megatron.post_training and megatron.post_training.* to the
include list so the module is packaged in the wheel.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
Commit bf71c14 added megatron/post_training/ but did not add it to
pyproject.toml's [tool.setuptools.packages.find] include list. This
causes ModuleNotFoundError when megatron.training imports from
megatron.post_training. Additionally, megatron/post_training/utils.py
eagerly imported modelopt at module level, breaking imports without
ModelOpt installed.

Add megatron.post_training and megatron.post_training.* to the
include list. Move modelopt imports into the functions that use them.

Signed-off-by: svcnemo-autobot <svcnemo-autobot@nvidia.com>
@nemo-autobot-origin
nemo-autobot-origin Bot force-pushed the fix/post-training-package branch from f43c850 to f998a88 Compare August 5, 2026 20:43
@svcnemo-autobot svcnemo-autobot changed the title fix(packaging): AUT-1323 include megatron.post_training in package discovery fix(packaging): AUT-1323 include megatron.post_training in package disco Aug 5, 2026
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

/ok to test f998a88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants