diff --git a/invokeai/app/invocations/compel.py b/invokeai/app/invocations/compel.py index c11ebd3f56..7c3ce7a819 100644 --- a/invokeai/app/invocations/compel.py +++ b/invokeai/app/invocations/compel.py @@ -108,15 +108,17 @@ class CompelInvocation(BaseInvocation): for trigger in re.findall(r"<[a-zA-Z0-9., _-]+>", self.prompt): name = trigger[1:-1] try: - ti_list.append(( - name, - context.services.model_manager.get_model( - model_name=name, - base_model=self.clip.text_encoder.base_model, - model_type=ModelType.TextualInversion, - context=context, - ).context.model - )) + ti_list.append( + ( + name, + context.services.model_manager.get_model( + model_name=name, + base_model=self.clip.text_encoder.base_model, + model_type=ModelType.TextualInversion, + context=context, + ).context.model, + ) + ) except ModelNotFoundException: # print(e) # import traceback @@ -197,15 +199,17 @@ class SDXLPromptInvocationBase: for trigger in re.findall(r"<[a-zA-Z0-9., _-]+>", prompt): name = trigger[1:-1] try: - ti_list.append(( - name, - context.services.model_manager.get_model( - model_name=name, - base_model=clip_field.text_encoder.base_model, - model_type=ModelType.TextualInversion, - context=context, - ).context.model - )) + ti_list.append( + ( + name, + context.services.model_manager.get_model( + model_name=name, + base_model=clip_field.text_encoder.base_model, + model_type=ModelType.TextualInversion, + context=context, + ).context.model, + ) + ) except ModelNotFoundException: # print(e) # import traceback @@ -272,15 +276,17 @@ class SDXLPromptInvocationBase: for trigger in re.findall(r"<[a-zA-Z0-9., _-]+>", prompt): name = trigger[1:-1] try: - ti_list.append(( - name, - context.services.model_manager.get_model( - model_name=name, - base_model=clip_field.text_encoder.base_model, - model_type=ModelType.TextualInversion, - context=context, - ).context.model - )) + ti_list.append( + ( + name, + context.services.model_manager.get_model( + model_name=name, + base_model=clip_field.text_encoder.base_model, + model_type=ModelType.TextualInversion, + context=context, + ).context.model, + ) + ) except ModelNotFoundException: # print(e) # import traceback diff --git a/invokeai/app/invocations/onnx.py b/invokeai/app/invocations/onnx.py index dec5b939a0..fe9a64552e 100644 --- a/invokeai/app/invocations/onnx.py +++ b/invokeai/app/invocations/onnx.py @@ -74,14 +74,16 @@ class ONNXPromptInvocation(BaseInvocation): for trigger in re.findall(r"<[a-zA-Z0-9., _-]+>", self.prompt): name = trigger[1:-1] try: - ti_list.append(( - name, - context.services.model_manager.get_model( - model_name=name, - base_model=self.clip.text_encoder.base_model, - model_type=ModelType.TextualInversion, - ).context.model - )) + ti_list.append( + ( + name, + context.services.model_manager.get_model( + model_name=name, + base_model=self.clip.text_encoder.base_model, + model_type=ModelType.TextualInversion, + ).context.model, + ) + ) except Exception: # print(e) # import traceback diff --git a/invokeai/backend/model_management/model_cache.py b/invokeai/backend/model_management/model_cache.py index 71e1ebc0d4..2b8d020269 100644 --- a/invokeai/backend/model_management/model_cache.py +++ b/invokeai/backend/model_management/model_cache.py @@ -186,7 +186,7 @@ class ModelCache(object): cache_entry = self._cached_models.get(key, None) if cache_entry is None: self.logger.info( - f"Loading model {model_path}, type {base_model.value}:{model_type.value}:{submodel.value if submodel else ''}" + f"Loading model {model_path}, type {base_model.value}:{model_type.value}{':'+submodel.value if submodel else ''}" ) # this will remove older cached models until diff --git a/invokeai/backend/model_management/model_manager.py b/invokeai/backend/model_management/model_manager.py index 832a96e18f..3fd59d1533 100644 --- a/invokeai/backend/model_management/model_manager.py +++ b/invokeai/backend/model_management/model_manager.py @@ -670,7 +670,7 @@ class ModelManager(object): # TODO: if path changed and old_model.path inside models folder should we delete this too? # remove conversion cache as config changed - old_model_path = self.app_config.root_path / old_model.path + old_model_path = self.resolve_model_path(old_model.path) old_model_cache = self._get_model_cache_path(old_model_path) if old_model_cache.exists(): if old_model_cache.is_dir(): @@ -780,7 +780,7 @@ class ModelManager(object): model_type, **submodel, ) - checkpoint_path = self.app_config.root_path / info["path"] + checkpoint_path = self.resolve_model_path(info["path"]) old_diffusers_path = self.resolve_model_path(model.location) new_diffusers_path = ( dest_directory or self.app_config.models_path / base_model.value / model_type.value @@ -992,7 +992,7 @@ class ModelManager(object): model_manager=self, prediction_type_helper=ask_user_for_prediction_type, ) - known_paths = {config.root_path / x["path"] for x in self.list_models()} + known_paths = {self.resolve_model_path(x["path"]) for x in self.list_models()} directories = { config.root_path / x for x in [