diff --git a/invokeai/backend/install/invokeai_configure.py b/invokeai/backend/install/invokeai_configure.py index 0d3f98155c..98b92858e7 100755 --- a/invokeai/backend/install/invokeai_configure.py +++ b/invokeai/backend/install/invokeai_configure.py @@ -13,8 +13,8 @@ import os import shutil import textwrap import traceback -import warnings import yaml +import warnings from argparse import Namespace from pathlib import Path from shutil import get_terminal_size @@ -56,7 +56,6 @@ from invokeai.frontend.install.widgets import ( from invokeai.backend.install.legacy_arg_parsing import legacy_parser from invokeai.backend.install.model_install_backend import ( hf_download_from_pretrained, - hf_download_with_resume, InstallSelections, ModelInstall, ) @@ -391,7 +390,7 @@ Use cursor arrows to make a checkbox selection, and space to toggle. self.autoimport_dirs = {} self.autoimport_dirs['autoimport_dir'] = self.add_widget_intelligent( FileBox, - name=f'Autoimport Folder', + name='Autoimport Folder', value=str(config.root_path / config.autoimport_dir), select_dir=True, must_exist=False, @@ -583,7 +582,18 @@ def initialize_rootdir(root: Path, yes_to_all: bool = False): path = dest / 'core' path.mkdir(parents=True, exist_ok=True) - with open(root / 'configs' / 'models.yaml','w') as yaml_file: + maybe_create_models_yaml(root) + +def maybe_create_models_yaml(root: Path): + models_yaml = root / 'configs' / 'models.yaml' + if models_yaml.exists(): + if OmegaConf.load(models_yaml).get('__metadata__'): # up to date + return + else: + logger.info('Creating new models.yaml, original saved as models.yaml.orig') + models_yaml.rename(models_yaml.parent / 'models.yaml.orig') + + with open(models_yaml,'w') as yaml_file: yaml_file.write(yaml.dump({'__metadata__': {'version':'3.0.0'} }