Fix model info cache for package models (#46567)
Signed-off-by: soaringk <k3vin.zhang@gmail.com>
This commit is contained in:
@@ -20,6 +20,7 @@ from vllm.model_executor.models.registry import (
|
||||
_SPECULATIVE_DECODING_MODELS,
|
||||
_TEXT_GENERATION_MODELS,
|
||||
ModelRegistry,
|
||||
_LazyRegisteredModel,
|
||||
)
|
||||
from vllm.platforms import current_platform
|
||||
|
||||
@@ -127,6 +128,22 @@ def test_registry_is_pp(model_arch, is_pp, init_cuda):
|
||||
)
|
||||
|
||||
|
||||
def test_lazy_modelinfo_package_hash_includes_submodules(tmp_path):
|
||||
package_dir = tmp_path / "model_package"
|
||||
package_dir.mkdir()
|
||||
init_file = package_dir / "__init__.py"
|
||||
init_file.write_text("from .model import Model\n", encoding="utf-8")
|
||||
model_file = package_dir / "model.py"
|
||||
model_file.write_text("class Model: pass\n", encoding="utf-8")
|
||||
|
||||
first_hash = _LazyRegisteredModel._get_modelinfo_module_hash(init_file)
|
||||
|
||||
model_file.write_text("class Model:\n supports_pp = True\n", encoding="utf-8")
|
||||
second_hash = _LazyRegisteredModel._get_modelinfo_module_hash(init_file)
|
||||
|
||||
assert first_hash != second_hash
|
||||
|
||||
|
||||
def test_hf_registry_coverage():
|
||||
untested_archs = (
|
||||
ModelRegistry.get_supported_archs() - HF_EXAMPLE_MODELS.get_supported_archs()
|
||||
|
||||
Reference in New Issue
Block a user