@@ -178,16 +178,11 @@ def test_model_config_is_opt_in_per_family() -> None:
178178 assert not hasattr (MegatronModelBridge , "TRANSFORMER_CONFIG_CLASS" )
179179
180180
181- def test_bridge_subclass_inherits_or_disables_model_config_opt_in () -> None :
181+ def test_bridge_subclass_inherits_model_config_opt_in () -> None :
182182 class DerivedBridge (LlamaBridge ):
183183 pass
184184
185- class UnsupportedBridge (LlamaBridge ):
186- MODEL_CONFIG_CLASS = None
187-
188185 assert DerivedBridge .MODEL_CONFIG_CLASS is BridgeGPTModelConfig
189- with pytest .raises (ModelConfigNotSupportedError , match = "UnsupportedBridge.*to_megatron_provider" ):
190- UnsupportedBridge ().hf_config_to_model_config (object ())
191186
192187
193188@pytest .mark .parametrize ("bridge_class" , _all_bridge_classes (), ids = lambda bridge_class : bridge_class .__name__ )
@@ -202,6 +197,15 @@ def test_bridge_can_explicitly_disable_model_config(bridge_class: type[MegatronM
202197 # Opted-in family: it must map its Hugging Face config for the builder path.
203198 assert _has_model_config_mapping (bridge_class )
204199
200+ # A bridge that replaces hf_config_to_model_config() wholesale does not read MODEL_CONFIG_CLASS.
201+ if bridge_class .hf_config_to_model_config is MegatronModelBridge .hf_config_to_model_config :
202+
203+ class UnsupportedBridge (bridge_class ):
204+ MODEL_CONFIG_CLASS = None
205+
206+ with pytest .raises (ModelConfigNotSupportedError , match = "UnsupportedBridge.*to_megatron_provider" ):
207+ UnsupportedBridge ().hf_config_to_model_config (object ())
208+
205209
206210def test_unmigrated_bridge_keeps_provider_without_warning () -> None :
207211 hf_config = Qwen2Config (
0 commit comments