make configure script work properly on empty rootdir

This commit is contained in:
Lincoln Stein 2023-06-17 19:26:35 -04:00
parent 15f8132e17
commit ddb3f4b02b
3 changed files with 17 additions and 12 deletions

View File

@ -671,7 +671,8 @@ def initialize_rootdir(root: Path, yes_to_all: bool = False):
} }
) )
) )
with open(root / 'invokeai.yaml','w') as f:
f.write('#empty invokeai.yaml initialization file')
# ------------------------------------- # -------------------------------------
def run_console_ui( def run_console_ui(
@ -827,8 +828,6 @@ def main():
errors = set() errors = set()
try: try:
models_to_download = default_user_selections(opt)
# We check for to see if the runtime directory is correctly initialized. # We check for to see if the runtime directory is correctly initialized.
old_init_file = config.root_path / 'invokeai.init' old_init_file = config.root_path / 'invokeai.init'
new_init_file = config.root_path / 'invokeai.yaml' new_init_file = config.root_path / 'invokeai.yaml'
@ -841,6 +840,7 @@ def main():
if not config.model_conf_path.exists(): if not config.model_conf_path.exists():
initialize_rootdir(config.root_path, opt.yes_to_all) initialize_rootdir(config.root_path, opt.yes_to_all)
models_to_download = default_user_selections(opt)
if opt.yes_to_all: if opt.yes_to_all:
write_default_options(opt, new_init_file) write_default_options(opt, new_init_file)
init_options = Namespace( init_options = Namespace(

View File

@ -95,6 +95,8 @@ class ModelInstall(object):
prediction_type_helper: Callable[[Path],SchedulerPredictionType]=None, prediction_type_helper: Callable[[Path],SchedulerPredictionType]=None,
access_token:str = None): access_token:str = None):
self.config = config self.config = config
with open('log.txt','w') as file:
print(config.model_conf_path,file=file)
self.mgr = ModelManager(config.model_conf_path) self.mgr = ModelManager(config.model_conf_path)
self.datasets = OmegaConf.load(Dataset_path) self.datasets = OmegaConf.load(Dataset_path)
self.prediction_helper = prediction_type_helper self.prediction_helper = prediction_type_helper

View File

@ -173,13 +173,14 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
rely=-3, rely=-3,
when_pressed_function=self.on_back, when_pressed_function=self.on_back,
) )
self.ok_button = self.add_widget_intelligent( else:
npyscreen.ButtonPress, self.ok_button = self.add_widget_intelligent(
name=done_label, npyscreen.ButtonPress,
relx=(window_width - len(done_label)) // 2, name=done_label,
rely=-3, relx=(window_width - len(done_label)) // 2,
when_pressed_function=self.on_execute rely=-3,
) when_pressed_function=self.on_execute
)
label = "APPLY CHANGES & EXIT" label = "APPLY CHANGES & EXIT"
self.done = self.add_widget_intelligent( self.done = self.add_widget_intelligent(
@ -529,6 +530,8 @@ class addModelsForm(CyclingForm, npyscreen.FormMultiPage):
ui_sections = [self.starter_pipelines, self.pipeline_models, ui_sections = [self.starter_pipelines, self.pipeline_models,
self.controlnet_models, self.lora_models, self.ti_models] self.controlnet_models, self.lora_models, self.ti_models]
for section in ui_sections: for section in ui_sections:
if not 'models_selected' in section:
continue
selected = set([section['models'][x] for x in section['models_selected'].value]) selected = set([section['models'][x] for x in section['models_selected'].value])
models_to_install = [x for x in selected if not self.all_models[x].installed] models_to_install = [x for x in selected if not self.all_models[x].installed]
models_to_remove = [x for x in section['models'] if x not in selected and self.all_models[x].installed] models_to_remove = [x for x in section['models'] if x not in selected and self.all_models[x].installed]