refactor(mm): add model config parsing utils

This commit is contained in:
psychedelicious
2025-09-24 17:42:56 +10:00
parent fd47da6842
commit 3488975b2b
4 changed files with 316 additions and 323 deletions

View File

@@ -7,7 +7,8 @@ from pathlib import Path
from typing import get_args
from invokeai.backend.model_hash.model_hash import HASHING_ALGORITHMS
from invokeai.backend.model_manager import InvalidModelConfigException, ModelConfigBase, ModelProbe
from invokeai.backend.model_manager import InvalidModelConfigException, ModelProbe
from invokeai.backend.model_manager.config import ModelConfigFactory
algos = ", ".join(set(get_args(HASHING_ALGORITHMS)))
@@ -30,7 +31,7 @@ def classify_with_fallback(path: Path, hash_algo: HASHING_ALGORITHMS):
try:
return ModelProbe.probe(path, hash_algo=hash_algo)
except InvalidModelConfigException:
return ModelConfigBase.classify(path, hash_algo)
return ModelConfigFactory.from_model_on_disk(mod=path, hash_algo=hash_algo,)
for path in args.model_path: