We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 623fc09 commit 840debfCopy full SHA for 840debf
1 file changed
modelopt/torch/export/model_utils.py
@@ -148,9 +148,9 @@ def get_language_model_from_vl(model) -> list[nn.Module] | None:
148
return [model, model.language_model]
149
150
# Pattern 3: For encoder-decoder VL models (e.g., Nemotron-Parse), the decoder is the language model.
151
- # Note: This is safe because this function is only called when the model is already detected as a VLM.
152
- # Non-VLM encoder-decoder models (T5, Bart) won't reach this code path.
153
- if hasattr(model, "decoder"):
+ # Only match if the model is detected as multimodal to avoid matching non-VLM encoder-decoder
+ # models like T5, Bart, Whisper which also have .decoder.
+ if hasattr(model, "decoder") and is_multimodal_model(model):
154
return [model, model.decoder]
155
156
# Pattern 4: No language_model found
0 commit comments