diff --git a/invokeai/backend/model_management/model_manager.py b/invokeai/backend/model_management/model_manager.py index c62f42b88d..3a4f9c1e66 100644 --- a/invokeai/backend/model_management/model_manager.py +++ b/invokeai/backend/model_management/model_manager.py @@ -568,6 +568,9 @@ class ModelManager(object): model_type=cur_model_type, ) + # expose paths as absolute + if path := model_dict.get('path'): + model_dict['path'] = str(self.app_config.root_path / path) models.append(model_dict) return models @@ -635,6 +638,11 @@ class ModelManager(object): The returned dict has the same format as the dict returned by model_info(). """ + # relativize paths as they go in - this makes it easier to move the root directory around + self.logger.debug(model_attributes) + if path := model_attributes.get('path'): + if Path(path).is_relative_to(self.app_config.root_path): + model_attributes['path'] = str(Path(path).relative_to(self.app_config.root_path)) model_class = MODEL_CLASSES[base_model][model_type] model_config = model_class.create_config(**model_attributes)