Fix issue 296

This commit is contained in:
bmaltais 2023-03-04 17:46:32 -05:00
parent 819a5718ea
commit e93de7f8ea
5 changed files with 13 additions and 9 deletions

View File

@ -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 = {}

View File

@ -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 = {}

View File

@ -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

View File

@ -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 = {}

View File

@ -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 = {}