2121from megatron .bridge .models .hf_pretrained .causal_lm import PreTrainedCausalLM
2222
2323
24+ # Bound the processor workaround to the releases whose loading behavior we tested.
25+ # Future releases use their own loader and surface errors rather than silently
26+ # dropping a required VLM artifact during conversion/export.
27+ _PROCESSOR_ADAPTER_RELEASES = ("5.18.0" , "5.19.0" , "5.20.0" )
28+
29+
2430class Nemotron35VLPretrained (PreTrainedCausalLM ):
2531 """Keep native processor compatibility separate from legacy remote-code loading."""
2632
@@ -38,23 +44,20 @@ def _get_auto_model_class(self) -> type:
3844 # uses it: native exports have no remote CausalLM registration.
3945 if self ._uses_remote_model ():
4046 return super ()._get_auto_model_class ()
41- if Version (transformers .__version__ ) < Version ("5.19 .0" ):
42- raise ValueError ("Native Super-VL requires Transformers >=5.19 .0; use trust_remote_code=True otherwise." )
47+ if Version (transformers .__version__ ) < Version ("5.18 .0" ):
48+ raise ValueError ("Native Super-VL requires Transformers >=5.18 .0; use trust_remote_code=True otherwise." )
4349 return AutoModelForImageTextToText
4450
4551 def _load_processor (self ) -> ProcessorMixin | None :
4652 if self .model_name_or_path is None or self ._uses_remote_model ():
4753 return super ()._load_processor ()
4854
4955 version = Version (transformers .__version__ )
50- if version < Version ("5.19 .0" ):
51- raise ValueError ("Native Super-VL requires Transformers >=5.19 .0; use trust_remote_code=True otherwise." )
56+ if version < Version ("5.18 .0" ):
57+ raise ValueError ("Native Super-VL requires Transformers >=5.18 .0; use trust_remote_code=True otherwise." )
5258
5359 processor_cls = AutoProcessor
54- # Bound the workaround to the release whose loading behavior we tested.
55- # Future releases use their own loader and surface errors rather than
56- # silently dropping a required VLM artifact during conversion/export.
57- if version .base_version == "5.19.0" and getattr (self .config , "audio_config" , None ) is None :
60+ if version .base_version in _PROCESSOR_ADAPTER_RELEASES and getattr (self .config , "audio_config" , None ) is None :
5861 from megatron .bridge .models .nemotron_omni .processing_super_vl import Nemotron35VLProcessor
5962
6063 processor_cls = Nemotron35VLProcessor
0 commit comments