Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 8 additions & 5 deletions invokeai/app/services/model_install/model_install_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
AnyModelConfig,
CheckpointConfigBase,
InvalidModelConfigException,
ModelConfigBase,
)
from invokeai.backend.model_manager.legacy_probe import ModelProbe
from invokeai.backend.model_manager.metadata import (
Expand Down Expand Up @@ -647,10 +646,14 @@ def _probe(self, model_path: Path, config: Optional[ModelRecordChanges] = None):
hash_algo = self._app_config.hashing_algorithm
fields = config.model_dump()

try:
return ModelConfigBase.classify(model_path=model_path, hash_algo=hash_algo, **fields)
except InvalidModelConfigException:
return ModelProbe.probe(model_path=model_path, fields=fields, hash_algo=hash_algo) # type: ignore
return ModelProbe.probe(model_path=model_path, fields=fields, hash_algo=hash_algo)

# New model probe API is disabled pending resolution of issue caused by a change of the ordering of checks.
# See commit message for details.
# try:
# return ModelConfigBase.classify(model_path=model_path, hash_algo=hash_algo, **fields)
# except InvalidModelConfigException:
# return ModelProbe.probe(model_path=model_path, fields=fields, hash_algo=hash_algo) # type: ignore

def _register(
self, model_path: Path, config: Optional[ModelRecordChanges] = None, info: Optional[AnyModelConfig] = None
Expand Down
1 change: 1 addition & 0 deletions tests/test_model_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def test_minimal_working_example(datadir: Path):
assert config.fun_quote == "Minimal working example of a ModelConfigBase subclass"


@pytest.mark.xfail(reason="Known issue with 'helloyoung25d_V15j.safetensors'.", strict=True)
def test_regression_against_model_probe(datadir: Path, override_model_loading):
"""Verifies results from ModelConfigBase.classify are consistent with those from ModelProbe.probe.
The test paths are gathered from the 'test_model_probe' directory.
Expand Down
Git LFS file not shown