diff --git a/README.md b/README.md index 7c847e6..f7a97ae 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,9 @@ This will store your a backup file with your current locally installed pip packa ## Change History +* 2023/03/01 (v21.0.1): + - Add warning to tensorboard start if the log information is missing + - Fix issue with 8bitadam on older config file load * 2023/02/27 (v21.0.0): - Add tensorboard start and stop support to the GUI * 2023/02/26 (v20.8.2): diff --git a/dreambooth_gui.py b/dreambooth_gui.py index 1e76d89..bf48991 100644 --- a/dreambooth_gui.py +++ b/dreambooth_gui.py @@ -25,6 +25,7 @@ from library.common_gui import ( gradio_config, gradio_source_model, set_legacy_8bitadam, + update_optimizer, ) from library.tensorboard_gui import ( gradio_tensorboard, @@ -208,6 +209,8 @@ def open_configuration( with open(file_path, 'r') as f: 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) 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/finetune_gui.py b/finetune_gui.py index 7777a7f..d1f6393 100644 --- a/finetune_gui.py +++ b/finetune_gui.py @@ -19,6 +19,7 @@ from library.common_gui import ( color_aug_changed, run_cmd_training, set_legacy_8bitadam, + update_optimizer, ) from library.tensorboard_gui import ( gradio_tensorboard, @@ -203,21 +204,22 @@ def open_config_file( original_file_path = file_path file_path = get_file_path(file_path) - if file_path != '' and file_path != None: - print(f'Loading config file {file_path}') + if not file_path == '' and not file_path == None: # load variables from JSON file with open(file_path, 'r') as f: - my_data_ft = json.load(f) + 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) else: - file_path = original_file_path # In case a file_path was provided and the user decide to cancel the open action - my_data_ft = {} + file_path = original_file_path # In case a file_path was provided and the user decide to cancel the open action + my_data_db = {} values = [file_path] for key, value in parameters: - # Set the value in the dictionary to the corresponding value in `my_data_ft`, or the default value if not found + # Set the value in the dictionary to the corresponding value in `my_data`, or the default value if not found if not key in ['file_path']: - values.append(my_data_ft.get(key, value)) - # print(values) + values.append(my_data_db.get(key, value)) return tuple(values) diff --git a/library/common_gui.py b/library/common_gui.py index 25089af..69240c1 100644 --- a/library/common_gui.py +++ b/library/common_gui.py @@ -9,6 +9,12 @@ refresh_symbol = '\U0001f504' # 🔄 save_style_symbol = '\U0001f4be' # 💾 document_symbol = '\U0001F4C4' # 📄 +def update_optimizer(my_data): + if my_data.get('use_8bit_adam', False): + my_data['optimizer'] = 'AdamW8bit' + my_data['use_8bit_adam'] = False + return my_data + def get_dir_and_file(file_path): dir_path, file_name = os.path.split(file_path) @@ -604,7 +610,8 @@ def gradio_advanced_training(): label='Memory efficient attention', value=False ) with gr.Row(): - use_8bit_adam = gr.Checkbox(label='Use 8bit adam', value=True) + # This use_8bit_adam element should be removed in a future release as it is no longer used + use_8bit_adam = gr.Checkbox(label='Use 8bit adam', value=False, visible=False) xformers = gr.Checkbox(label='Use xformers', value=True) color_aug = gr.Checkbox(label='Color augmentation', value=False) flip_aug = gr.Checkbox(label='Flip augmentation', value=False) diff --git a/lora_gui.py b/lora_gui.py index b1f3f34..ac7d69e 100644 --- a/lora_gui.py +++ b/lora_gui.py @@ -25,6 +25,7 @@ from library.common_gui import ( gradio_source_model, run_cmd_training, set_legacy_8bitadam, + update_optimizer, ) from library.dreambooth_folder_creation_gui import ( gradio_dreambooth_folder_creation_tab, @@ -225,6 +226,8 @@ def open_configuration( with open(file_path, 'r') as f: 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) 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 aaa4df3..cc93beb 100644 --- a/textual_inversion_gui.py +++ b/textual_inversion_gui.py @@ -25,6 +25,7 @@ from library.common_gui import ( gradio_config, gradio_source_model, set_legacy_8bitadam, + update_optimizer, ) from library.tensorboard_gui import ( gradio_tensorboard, @@ -218,6 +219,8 @@ def open_configuration( with open(file_path, 'r') as f: 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) 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 = {}