fix: handle list-format quant_cfg from ModelOpt PR #1094 - #4187
Conversation
|
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:
See the contribution guide for more details. |
cf20883 to
7d8d36f
Compare
1550efc to
8bc5455
Compare
|
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. |
ModelOpt PR NVIDIA#1094 changed quant_cfg from a flat dict keyed by quantizer name to an ordered list of QuantizerCfgEntry dicts with an explicit 'quantizer_name' field. quantize.py was directly indexing the dict (e.g. quant_cfg['*medusa_heads**'] = ...) which crashes with a TypeError when quant_cfg is a list. Add _set_quant_cfg_entry() and _get_quant_cfg_entry() helpers that write to and read from either format, and update all call sites in get_modelopt_torch_quantization_config(), get_first_layers_disabled_config(), and get_last_layers_disabled_config() to use them. Signed-off-by: chenhany <chenhany@nvidia.com>
ModelOpt PR NVIDIA#1094 changed QuantizerCfgEntry to require quantizer attributes under a 'cfg' sub-key rather than at the top level. Update fp8_config and fp4_config in quantize.py accordingly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
initialize_megatron() and pretrain() no longer accept extra_args_provider and args_defaults after commit 97aca2f. Use parse_and_validate_args() from megatron.training.arguments to parse args before calling initialize_megatron()/pretrain(). Affected files: - quantize.py, validate.py, prune.py, mmlu.py, export.py - convert_model.py, offline_feature_extract.py, generate.py - finetune.py (uses pretrain() instead of initialize_megatron()) Signed-off-by: Chenhan Yu <chenhany@nvidia.com>
8bc5455 to
c11adb0
Compare
…ency-ext Some container versions renamed get_write_results_queue to _get_write_results_queue. Add fallback import to handle both.
Set DISABLE_NVRX=1 to force HAVE_NVRX=False and use mcore's own checkpoint implementation. Workaround for containers where nvrx is incompatible with the installed PyTorch version.
nvidia-resiliency-ext's FileSystemWriterAsync is incompatible with some container PyTorch versions. DISABLE_NVRX forces mcore fallback.
| #!/bin/bash | ||
|
|
||
| # Disable nvidia-resiliency-ext (incompatible with some container PyTorch versions) | ||
| export DISABLE_NVRX=1 |
There was a problem hiding this comment.
can you add this in arguments.sh instead of in multiple places?
|
|
||
| ModelOpt PR #1094 changed quant_cfg from a flat dict keyed by quantizer name | ||
| to an ordered list of QuantizerCfgEntry dicts with an explicit "quantizer_name" | ||
| field. This helper writes to either format so callers don't need to branch. |
There was a problem hiding this comment.
could this be moved to ModelOpt quant cfg class to add get/set functions so that it is backward compatible?
There was a problem hiding this comment.
The old format is problematic and deprecated, but backward compatibility is kept:
The ModelOpt code automatically convert the old formatted configs into new format configs at the time parsing the config
The issues we were hitting are from code manipulating the old formatted configs, such as updating quantization format of one quantizer. These code is not in consideration for backward compatibility.
We do not want to bring those manipulation code back into modelopt library.
There was a problem hiding this comment.
I've updated the code to convert from old dict format to list format if it detects an old modelopt config, and to only manipulate list configs
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Jennifer Chen <jennifchen@nvidia.com>
Signed-off-by: Jennifer Chen <jennifchen@nvidia.com>
Signed-off-by: Jennifer Chen <jennifchen@nvidia.com>
|
/ok to test a62125b |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/25056285782 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/25056874744 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/25068932293 |
…A#4187) Signed-off-by: chenhany <chenhany@nvidia.com> Signed-off-by: Chenhan Yu <chenhany@nvidia.com> Signed-off-by: Jennifer Chen <jennifchen@nvidia.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Jennifer Chen <jennifchen@nvidia.com>
…A#4187) Signed-off-by: chenhany <chenhany@nvidia.com> Signed-off-by: Chenhan Yu <chenhany@nvidia.com> Signed-off-by: Jennifer Chen <jennifchen@nvidia.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Jennifer Chen <jennifchen@nvidia.com> Signed-off-by: yhgalaxy <yhgalaxy@outlook.com>
…A#4187) Signed-off-by: chenhany <chenhany@nvidia.com> Signed-off-by: Chenhan Yu <chenhany@nvidia.com> Signed-off-by: Jennifer Chen <jennifchen@nvidia.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Jennifer Chen <jennifchen@nvidia.com> Signed-off-by: Jon Barker <jbarker@aws-cmh-slurm-1-vscode-02.cm.cluster>
…A#4187) Signed-off-by: chenhany <chenhany@nvidia.com> Signed-off-by: Chenhan Yu <chenhany@nvidia.com> Signed-off-by: Jennifer Chen <jennifchen@nvidia.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Jennifer Chen <jennifchen@nvidia.com>
ModelOpt PR #1094 changed quant_cfg from a flat dict keyed by quantizer name to an ordered list of QuantizerCfgEntry dicts with an explicit 'quantizer_name' field. quantize.py was directly indexing the dict (e.g. quant_cfg['medusa_heads*'] = ...) which crashes with a TypeError when quant_cfg is a list.
Add _set_quant_cfg_entry() and _get_quant_cfg_entry() helpers that write to and read from either format, and update all call sites in get_modelopt_torch_quantization_config(), get_first_layers_disabled_config(), and get_last_layers_disabled_config() to use them.
What does this PR do ?
Contribution process
Pre-checks
Code review
Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.
For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.