[AMD] Fix Grok-2 nightly: avoid multimodal misdetection from auto-populated vision_config (#23383)
This commit is contained in:
@@ -180,11 +180,18 @@ class ModelConfig:
|
|||||||
self.is_generation = is_generation_model(
|
self.is_generation = is_generation_model(
|
||||||
self.hf_config.architectures, is_embedding
|
self.hf_config.architectures, is_embedding
|
||||||
)
|
)
|
||||||
has_multimodal_subconfig = (
|
# The vision_config/audio_config attribute heuristic is only applied when
|
||||||
self.hf_config is not self.hf_text_config
|
# the transformers backend is explicitly requested. Some text-only models
|
||||||
or hasattr(self.hf_config, "vision_config")
|
# (e.g. xai-org/grok-2 with model_type="git") would otherwise be
|
||||||
|
# false-positively detected because their HF config auto-populates a
|
||||||
|
# `vision_config` in __post_init__.
|
||||||
|
has_multimodal_subconfig = self.hf_config is not self.hf_text_config or (
|
||||||
|
self.model_impl == ModelImpl.TRANSFORMERS
|
||||||
|
and (
|
||||||
|
hasattr(self.hf_config, "vision_config")
|
||||||
or hasattr(self.hf_config, "audio_config")
|
or hasattr(self.hf_config, "audio_config")
|
||||||
)
|
)
|
||||||
|
)
|
||||||
self.is_multimodal = enable_multimodal and (
|
self.is_multimodal = enable_multimodal and (
|
||||||
is_multimodal_model(self.hf_config.architectures)
|
is_multimodal_model(self.hf_config.architectures)
|
||||||
or has_multimodal_subconfig
|
or has_multimodal_subconfig
|
||||||
|
|||||||
Reference in New Issue
Block a user