[Bugfix] Skip VllmConfig re-validation for with_hf_config submodel views (#58212)
Signed-off-by: Nick Hill <nickhill123@gmail.com> Co-authored-by: Kimi Code <noreply@moonshot.ai> Co-authored-by: Roger Wang <rogerw@inferact.ai>
This commit is contained in:
co-authored by
Kimi Code
Roger Wang
parent
d110c2f19c
commit
826e300cde
@@ -187,6 +187,10 @@ class ModelConfig:
|
||||
"""The Hugging Face config of the model."""
|
||||
hf_text_config: PretrainedConfig = field(init=False)
|
||||
"""The Hugging Face config of the text model (same as hf_config for text models)."""
|
||||
is_submodel_config: bool = field(default=False, init=False)
|
||||
"""Whether this is a submodule view derived by `VllmConfig.with_hf_config`
|
||||
(e.g. a multimodal model's text stack). Its architecture list is empty, so
|
||||
deployment-level validation must not run against it."""
|
||||
word_embeddings_untied_by_checkpoint: bool = field(default=False, init=False)
|
||||
"""Whether `tie_word_embeddings` was overridden to `False` because the checkpoint
|
||||
contains an `lm_head` of its own. The two may still turn out to be identical, in
|
||||
@@ -1082,7 +1086,10 @@ class ModelConfig:
|
||||
# Check if the architecture we're wrapping has defaults
|
||||
runner = None
|
||||
task = None
|
||||
if defaults := try_match_architecture_defaults(self.architectures[0]):
|
||||
# architectures is empty for with_hf_config() submodel views.
|
||||
if self.architectures and (
|
||||
defaults := try_match_architecture_defaults(self.architectures[0])
|
||||
):
|
||||
_, (runner, task) = defaults
|
||||
# User specified value take precedence
|
||||
if self.runner != "auto":
|
||||
|
||||
@@ -943,6 +943,7 @@ class VllmConfig:
|
||||
|
||||
model_config.hf_config = hf_config
|
||||
model_config.model_arch_config = model_config.get_model_arch_config()
|
||||
model_config.is_submodel_config = True
|
||||
|
||||
return replace(self, model_config=model_config)
|
||||
|
||||
@@ -1331,6 +1332,12 @@ class VllmConfig:
|
||||
# To give each torch profile run a unique instance name.
|
||||
self.instance_id = f"{time.time_ns()}"
|
||||
|
||||
if self.model_config is not None and self.model_config.is_submodel_config:
|
||||
# with_hf_config() view: the parent config was already validated,
|
||||
# and this view's empty architecture list makes the model-dependent checks
|
||||
# below unsafe (e.g. use_mla resolves the architecture registry).
|
||||
return
|
||||
|
||||
self._resolve_mm_encoder_only()
|
||||
|
||||
if self.performance_mode != "balanced":
|
||||
|
||||
Reference in New Issue
Block a user