Skip to content

Commit a933977

Browse files
authored
Pick correct config file for sdxl models (#4191)
## What type of PR is this? (check all applicable) - [X] Bug Fix ## Have you discussed this change with the InvokeAI team? - [X] Yes - [ ] No, because: ## Have you updated all relevant documentation? - [X Yes - [ ] No ## Description If `models.yaml` is cleared out for some reason, the model manager will repopulate it by scanning `models`. However, this would fail with a pydantic validation error if any SDXL checkpoint models were present because the lack of logic to pick the correct configuration file. This has now been added.
2 parents e77400a + dfb41d8 commit a933977

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

invokeai/backend/model_management/model_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,9 @@ def scan_models_directory(
991991
raise DuplicateModelException(f"Model with key {model_key} added twice")
992992

993993
model_path = self.relative_model_path(model_path)
994-
model_config: ModelConfigBase = model_class.probe_config(str(model_path))
994+
model_config: ModelConfigBase = model_class.probe_config(
995+
str(model_path), model_base=cur_base_model
996+
)
995997
self.models[model_key] = model_config
996998
new_models_found = True
997999
except DuplicateModelException as e:

invokeai/backend/model_management/models/sdxl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,10 @@ def probe_config(cls, path: str, **kwargs):
8080
raise Exception("Unkown stable diffusion 2.* model format")
8181

8282
if ckpt_config_path is None:
83-
# TO DO: implement picking
84-
pass
83+
# avoid circular import
84+
from .stable_diffusion import _select_ckpt_config
85+
86+
ckpt_config_path = _select_ckpt_config(kwargs.get("model_base", BaseModelType.StableDiffusionXL), variant)
8587

8688
return cls.create_config(
8789
path=path,

0 commit comments

Comments
 (0)