Limit the deprecation's Megatron-Bridge recommendation to checkpoints it supports

Say 'planned for removal', name the Megatron-Bridge it needs, show the model-chunk and
source-path inputs, and list what it doesn't export yet (also INT8 weight-only and
language-model-only VLM checkpoints).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
This commit is contained in:
Keval Morabia
2026-12-01 09:47:46 -08:00
co-authored by Claude Opus 5.5
parent 9241b1f67b
commit 7c75acd305
2 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ Changelog
**Deprecations**
- ``modelopt.torch.export.export_mcore_gpt_to_hf`` is deprecated and will be removed in 0.51.0; it now emits a ``DeprecationWarning``. Export quantized Megatron-Core models to Hugging Face checkpoints with Megatron-Bridge (``AutoBridge.save_hf_pretrained_modelopt``) instead. Megatron-Bridge doesn't export GGML / IQ formats or EAGLE / Medusa modules (``export_extra_modules=True``) yet.
- ``modelopt.torch.export.export_mcore_gpt_to_hf`` is deprecated and planned for removal in 0.51.0; it now emits a ``DeprecationWarning``. Where it supports the checkpoint, export quantized Megatron-Core models to Hugging Face checkpoints with Megatron-Bridge's ``AutoBridge.save_hf_pretrained_modelopt`` (in Megatron-Bridge newer than the ``nemo:26.10`` container) instead, from the quantized model chunks and the local source checkpoint (``source_path``); see the function's docstring. It doesn't export GGML / IQ formats, EAGLE / Medusa modules (``export_extra_modules=True``), weight formats it can't pack (e.g. INT8 weight-only) or a VLM whose Megatron checkpoint holds only the language model yet.
**Bug Fixes**
@@ -2440,15 +2440,25 @@ def export_mcore_gpt_to_hf(
clamp_kv_cache_scales: Whether to clamp FP8 KV cache scaling factors to at least 1.0.
.. deprecated:: 0.50.0
Use Megatron-Bridge's ``AutoBridge.save_hf_pretrained_modelopt`` instead. It doesn't
export GGML / IQ formats or EAGLE / Medusa modules yet.
Planned for removal in 0.51.0. Where it supports the checkpoint, export with
Megatron-Bridge's ``AutoBridge.save_hf_pretrained_modelopt`` (in Megatron-Bridge newer
than the ``nemo:26.10`` container) instead, from the quantized model chunks and the local
HF source checkpoint:
.. code-block:: python
bridge = AutoBridge.from_hf_pretrained(hf_path)
bridge.save_hf_pretrained_modelopt(model_chunks, export_dir, source_path=hf_path)
It doesn't export these yet, so keep using this function for them: GGML / IQ formats,
EAGLE / Medusa modules (``export_extra_modules=True``), weight formats it can't pack
(e.g. INT8 weight-only), and a VLM whose Megatron checkpoint holds only the language model.
"""
warnings.warn(
"export_mcore_gpt_to_hf is deprecated as of 0.50.0 and will be removed in 0.51.0. Export "
"quantized Megatron-Core models with Megatron-Bridge instead, e.g. "
"AutoBridge.from_hf_pretrained(path).save_hf_pretrained_modelopt(model, export_dir, "
"source_path=path). Megatron-Bridge doesn't export GGML / IQ formats or EAGLE / Medusa "
"modules (export_extra_modules=True) yet; those still need this function.",
"export_mcore_gpt_to_hf is deprecated as of 0.50.0 and planned for removal in 0.51.0. "
"Where it supports the checkpoint, export with Megatron-Bridge's "
"AutoBridge.save_hf_pretrained_modelopt instead; see this function's docstring for what "
"it doesn't export yet (e.g. GGML / IQ formats, EAGLE / Medusa modules).",
DeprecationWarning,
stacklevel=2,
)