Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions vllm/model_executor/model_loader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def device_loading_context(module: torch.nn.Module,
# New parameters or parameters already on target device are untouched


_MODEL_ARCH_BY_HASH = dict[str, tuple[type[nn.Module], str]]()
_MODEL_ARCH_BY_HASH = dict[int, tuple[type[nn.Module], str]]()
"""Caches the outputs of `_get_model_architecture`."""


Expand Down Expand Up @@ -215,7 +215,14 @@ def _get_model_architecture(

def get_model_architecture(
model_config: ModelConfig) -> tuple[type[nn.Module], str]:
key = model_config.compute_hash()
key = hash((
model_config.model,
model_config.convert_type,
model_config.runner_type,
model_config.trust_remote_code,
model_config.model_impl,
tuple(getattr(model_config.hf_config, "architectures", [])),
))
if key in _MODEL_ARCH_BY_HASH:
return _MODEL_ARCH_BY_HASH[key]

Expand Down