From e93de7f8ea3569200dcf7faddc77e08ea36f40df Mon Sep 17 00:00:00 2001 From: bmaltais Date: Sat, 4 Mar 2023 17:46:32 -0500 Subject: [PATCH] Fix issue 296 --- dreambooth_gui.py | 4 ++-- finetune_gui.py | 4 ++-- library/common_gui.py | 6 +++++- lora_gui.py | 4 ++-- textual_inversion_gui.py | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dreambooth_gui.py b/dreambooth_gui.py index 017e749..84517e0 100644 --- a/dreambooth_gui.py +++ b/dreambooth_gui.py @@ -25,7 +25,7 @@ from library.common_gui import ( gradio_config, gradio_source_model, set_legacy_8bitadam, - update_optimizer, + my_data, ) from library.tensorboard_gui import ( gradio_tensorboard, @@ -214,7 +214,7 @@ def open_configuration( my_data = json.load(f) print('Loading config...') # Update values to fix deprecated use_8bit_adam checkbox and set appropriate optimizer if it is set to True - my_data = update_optimizer(my_data) + my_data = my_data(my_data) else: file_path = original_file_path # In case a file_path was provided and the user decide to cancel the open action my_data = {} diff --git a/finetune_gui.py b/finetune_gui.py index 762db05..251dee8 100644 --- a/finetune_gui.py +++ b/finetune_gui.py @@ -19,7 +19,7 @@ from library.common_gui import ( color_aug_changed, run_cmd_training, set_legacy_8bitadam, - update_optimizer, + my_data, ) from library.tensorboard_gui import ( gradio_tensorboard, @@ -216,7 +216,7 @@ def open_config_file( my_data_db = json.load(f) print('Loading config...') # Update values to fix deprecated use_8bit_adam checkbox and set appropriate optimizer if it is set to True - my_data = update_optimizer(my_data) + my_data = my_data(my_data) else: file_path = original_file_path # In case a file_path was provided and the user decide to cancel the open action my_data_db = {} diff --git a/library/common_gui.py b/library/common_gui.py index 331ad07..9251a27 100644 --- a/library/common_gui.py +++ b/library/common_gui.py @@ -10,10 +10,14 @@ save_style_symbol = '\U0001f4be' # 💾 document_symbol = '\U0001F4C4' # 📄 -def update_optimizer(my_data): +def my_data(my_data): if my_data.get('use_8bit_adam', False): my_data['optimizer'] = 'AdamW8bit' my_data['use_8bit_adam'] = False + + if my_data.get('model_list', 'custom') == []: + print('Old config with empty model list. Setting to custom...') + my_data['model_list'] = 'custom' return my_data diff --git a/lora_gui.py b/lora_gui.py index a836ee4..5026618 100644 --- a/lora_gui.py +++ b/lora_gui.py @@ -25,7 +25,7 @@ from library.common_gui import ( gradio_source_model, run_cmd_training, set_legacy_8bitadam, - update_optimizer, + my_data, ) from library.dreambooth_folder_creation_gui import ( gradio_dreambooth_folder_creation_tab, @@ -239,7 +239,7 @@ def open_configuration( my_data = json.load(f) print('Loading config...') # Update values to fix deprecated use_8bit_adam checkbox and set appropriate optimizer if it is set to True - my_data = update_optimizer(my_data) + my_data = my_data(my_data) else: file_path = original_file_path # In case a file_path was provided and the user decide to cancel the open action my_data = {} diff --git a/textual_inversion_gui.py b/textual_inversion_gui.py index 364d2a5..48d2793 100644 --- a/textual_inversion_gui.py +++ b/textual_inversion_gui.py @@ -25,7 +25,7 @@ from library.common_gui import ( gradio_config, gradio_source_model, set_legacy_8bitadam, - update_optimizer, + my_data, ) from library.tensorboard_gui import ( gradio_tensorboard, @@ -226,7 +226,7 @@ def open_configuration( my_data_db = json.load(f) print('Loading config...') # Update values to fix deprecated use_8bit_adam checkbox and set appropriate optimizer if it is set to True - my_data = update_optimizer(my_data) + my_data = my_data(my_data) else: file_path = original_file_path # In case a file_path was provided and the user decide to cancel the open action my_data_db = {}