Skip to content

Commit 8297b7e

Browse files
Fix duplicate model key addition when root directory is a relative path (#3607)
This fixes model directory scanning so that it works properly when the root is a relative path (e.g. ".").
2 parents e65e635 + 5be1e71 commit 8297b7e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

invokeai/backend/model_management/model_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,13 +675,15 @@ def scan_models_directory(
675675
base_model: Optional[BaseModelType] = None,
676676
model_type: Optional[ModelType] = None,
677677
):
678+
678679
loaded_files = set()
679680
new_models_found = False
680681

682+
self.logger.info(f'scanning {self.app_config.models_path} for new models')
681683
with Chdir(self.app_config.root_path):
682684
for model_key, model_config in list(self.models.items()):
683685
model_name, cur_base_model, cur_model_type = self.parse_key(model_key)
684-
model_path = self.app_config.root_path / model_config.path
686+
model_path = self.app_config.root_path.absolute() / model_config.path
685687
if not model_path.exists():
686688
model_class = MODEL_CLASSES[cur_base_model][cur_model_type]
687689
if model_class.save_to_config:

0 commit comments

Comments
 (0)