Repository navigation
feat(nemotron): native HF 5.19 Super VL conversion support - #6471
Conversation
Signed-off-by: Chen Cui <chcui@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. |
Signed-off-by: Chen Cui <chcui@nvidia.com> (cherry picked from commit 1a22a1e7e180689f1d672762df04d351f4276fbe)
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/review |
|
Automatic Claude reviews have been retired. To request a pull-request review, post a comment containing: Add |
Signed-off-by: Chen Cui <chcui@nvidia.com>
Signed-off-by: Chen Cui <chcui@nvidia.com>
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/review |
svcnvidia-nemo-ci
left a comment
There was a problem hiding this comment.
One blocking correctness finding: config-only HF exports bypass the new processor adapter and can silently omit processor artifacts.
Reviewed all 15 changed files and directly affected loading/export paths. This was a static review; tests were not executed. The documented standalone HF inference limitations are not treated as verified conversion support.
No perf tests impacted.
Suggested test cases
test_super_vl_config_only_export_preserves_native_processor— proposed regression covering both artifact-source options described inline.test_native_processor_load_save_reload[False]— retain exact image/video tensor and token-ID equality.test_native_processor_load_save_reload[True]— retain native reload when remote-code execution is permitted but not registered.test_super_vl_native_export_does_not_require_remote_modeling_file.test_super_vl_native_config_preserves_language_and_image_settings.test_vision_rope_correction_is_version_gated_and_idempotent.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex
| if "NemotronH_Omni_Reasoning_V3" in architectures: | ||
| from megatron.bridge.models.nemotron_omni.hf_pretrained import Nemotron35VLPretrained | ||
|
|
||
| return Nemotron35VLPretrained |
There was a problem hiding this comment.
[P2] Apply the native wrapper selection to config-only artifact export
Failure: This resolver is used by from_hf_pretrained, but the config-only branch of save_hf_pretrained still constructs PreTrainedCausalLM directly. Consequently, AutoBridge.from_auto_config(..., native_reference, trust_remote_code=False).save_hf_pretrained(...) does not use Nemotron35VLProcessor. For an audio-free 5.19.0 source requiring this adapter, ordinary AutoProcessor fails on the missing audio extractor, and the base wrapper silently returns None. Artifact saving therefore omits processor_config.json and processor/video settings instead of preserving the reloadable Bridge processor. Saving an image processor separately does not preserve those artifacts. The new roundtrip test exercises the specialized wrapper directly, so it misses this public export entrypoint.
Correction: In the non-text-only config-only artifact branch, use this resolver for causal-family wrappers. Preserve the existing artifact saver for non-causal heads rather than changing their artifact contracts. Suggested replacement for the direct construction at line 1266 (not executed; verify before adopting):
artifact_cls = _resolve_pretrained_wrapper_cls(self.hf_pretrained)
if not issubclass(artifact_cls, PreTrainedCausalLM):
artifact_cls = PreTrainedCausalLM
artifact_source = artifact_cls.from_pretrained(
artifact_source_path, **artifact_kwargs
)The invariant is that config-only native Super-VL exports use the same processor compatibility path as wrapper-backed exports, without materializing model weights.
Preservation and acceptance: Add proposed test_super_vl_config_only_export_preserves_native_processor, reusing the local processor_source fixture plus a native-schema config. Stub weight writing/postprocessing, export through a config-only bridge using both hf_model_id and source_path, and assert that processor_config.json exists, video_temporal_patch_dim remains 2, and Bridge reload reproduces the source image/video tensors and token IDs exactly. Retain the existing config-only reference-artifact test assertions that processor artifacts survive and reference weights are never loaded. Legacy Super-VL with a trusted remote registration must still delegate to the base processor loader and preserve remote modeling files; ordinary causal checkpoints must remain unchanged. Leave the separate text-only branch media-free, and retain the existing base artifact saver for masked/token-classification configurations.
Signed-off-by: Chen Cui <chcui@nvidia.com>
What does this PR do ?
Draft native Transformers 5.19 support for Nemotron 3.5 Super VL conversion, preserving legacy remote-code loading.
Work in progress—not ready to merge. Conversion passes exact weight checks, but the exported model is not yet a fully functional standalone HF checkpoint with
trust_remote_code=False.Changelog
text_configand image-token fields while retaining the legacyllm_configpath.>=5.15,<5.20and lock Transformers 5.19.0.GitHub Actions CI
Local verification used
nvcr.io/nvidia/nemo:26.08.01with an isolated Transformers 5.19.0 environment:atol=rtol=0, TP1/PP2/EP2/ETP1 on four H100s. Independently saved HF exports have identical tensor keys/shapes/dtypes/bytes. A subsequent persisted Megatron readback comparison passed: 1,104 logical tensors byte-identical, with no metadata or model-config differences.trust_remote_code=False, failed end-to-end validation:AutoProcessorstill requires an absent audio feature extractor.AutoModelForImageTextToTextloaded, but reported four unexpected vision normalization/buffer keys.mamba-ssmwithin the HF interpreter; the PyTorch fallback produced finite logits. With that explicit runtime condition, source/export logits were bitwise identical on three prompts (cosine 1, max difference 0), and all 16-token greedy continuations matched. This is not an automatic Bridge production workaround or a shared-package uninstall.torch.catreceives a tensor-valued videopooler_output, rather than a sequence. Exported visual parity remains unverified. This visual test is not a standalone HF processor workflow.Before your PR is "Ready for review"
Pre checks:
hf_pretrained.modelaccessor selection usingAutoModelForImageTextToText; retain CausalLM for text and actual remote registrations, not merely the trust permission.Additional Information
Scope is Nemotron 3.5 Super VL only, using
nvidia/NVIDIA-Nemotron-3.5-Super-VL-120B-A12B-Base-BF16for verification. This is not a Nemotron Omni native-HF migration.Independent reviews covered the complete diff and follow-up loader changes. Native HF-saved checkpoint key layouts and full standalone visual inference are not claimed supported by these original-checkpoint conversion tests. Remaining upstream/runtime limitations are explicit above.