Skip to content

Commit

Permalink
v21.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais committed Mar 2, 2023
1 parent 1e3055c commit 7f0e568
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
gradio_config,
gradio_source_model,
set_legacy_8bitadam,
update_optimizer,
)
from library.tensorboard_gui import (
gradio_tensorboard,
Expand Down Expand Up @@ -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 = {}
Expand Down
18 changes: 10 additions & 8 deletions finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
color_aug_changed,
run_cmd_training,
set_legacy_8bitadam,
update_optimizer,
)
from library.tensorboard_gui import (
gradio_tensorboard,
Expand Down Expand Up @@ -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)


Expand Down
9 changes: 8 additions & 1 deletion library/common_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
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)
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions lora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
gradio_source_model,
run_cmd_training,
set_legacy_8bitadam,
update_optimizer,
)
from library.dreambooth_folder_creation_gui import (
gradio_dreambooth_folder_creation_tab,
Expand Down Expand Up @@ -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 = {}
Expand Down
3 changes: 3 additions & 0 deletions textual_inversion_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
gradio_config,
gradio_source_model,
set_legacy_8bitadam,
update_optimizer,
)
from library.tensorboard_gui import (
gradio_tensorboard,
Expand Down Expand Up @@ -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 = {}
Expand Down

0 comments on commit 7f0e568

Please sign in to comment.