Skip to content

Commit

Permalink
Merge pull request #2048 from bmaltais/dev
Browse files Browse the repository at this point in the history
v23.0.1
  • Loading branch information
bmaltais authored Mar 9, 2024
2 parents 686990f + 8c760b5 commit 7dae63e
Show file tree
Hide file tree
Showing 30 changed files with 245 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v23.0.0
v23.0.1
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The GUI allows you to set the training parameters and generate and run the requi
- [No module called tkinter](#no-module-called-tkinter)
- [SDXL training](#sdxl-training)
- [Change History](#change-history)
- [2024/03/10 (v23.0.1)](#20240310-v2301)
- [2024/03/02 (v23.0.0)](#20240302-v2300)

## 🦒 Colab
Expand Down Expand Up @@ -363,6 +364,11 @@ The documentation in this section will be moved to a separate document later.
## Change History
### 2024/03/10 (v23.0.1)
- Update bitsandbytes module to 0.43.0 as it provide native windows support
- Minor fixes to code
### 2024/03/02 (v23.0.0)
- Use sd-scripts release [0.8.4](https://github.com/kohya-ss/sd-scripts/releases/tag/v0.8.4) post commit [fccbee27277d65a8dcbdeeb81787ed4116b92e0b](https://github.com/kohya-ss/sd-scripts/commit/fccbee27277d65a8dcbdeeb81787ed4116b92e0b)
Expand Down
4 changes: 2 additions & 2 deletions kohya_gui/basic_caption_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def list_images_dirs(path):
# Dropdown for image folder
images_dir = gr.Dropdown(
label='Image folder to caption (containing the images to caption)',
choices=list_images_dirs(default_images_dir),
choices=[""] + list_images_dirs(default_images_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand Down Expand Up @@ -198,7 +198,7 @@ def list_images_dirs(path):

# Event handler for dynamic update of dropdown choices
images_dir.change(
fn=lambda path: gr.Dropdown().update(choices=list_images_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_images_dirs(path)),
inputs=images_dir,
outputs=images_dir,
show_progress=False,
Expand Down
4 changes: 2 additions & 2 deletions kohya_gui/blip_caption_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def list_train_dirs(path):
with gr.Group(), gr.Row():
train_data_dir = gr.Dropdown(
label="Image folder to caption (containing the images to caption)",
choices=list_train_dirs(default_train_dir),
choices=[""] + list_train_dirs(default_train_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand Down Expand Up @@ -171,7 +171,7 @@ def list_train_dirs(path):
)

train_data_dir.change(
fn=lambda path: gr.Dropdown().update(choices=list_train_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_train_dirs(path)),
inputs=train_data_dir,
outputs=train_data_dir,
show_progress=False,
Expand Down
8 changes: 4 additions & 4 deletions kohya_gui/class_advanced_training.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def list_vae_files(path):
self.vae = gr.Dropdown(
label='VAE (Optional. path to checkpoint of vae to replace for training)',
interactive=True,
choices=list_vae_files(current_vae_dir),
choices=[""] + list_vae_files(current_vae_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -68,7 +68,7 @@ def list_vae_files(path):
)

self.vae.change(
fn=lambda path: gr.Dropdown().update(choices=list_vae_files(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_vae_files(path)),
inputs=self.vae,
outputs=self.vae,
show_progress=False,
Expand Down Expand Up @@ -306,7 +306,7 @@ def list_state_dirs(path):

self.resume = gr.Dropdown(
label='Resume from saved training state (path to "last-state" state folder)',
choices=list_state_dirs(current_state_dir),
choices=[""] + list_state_dirs(current_state_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand All @@ -321,7 +321,7 @@ def list_state_dirs(path):
show_progress=False,
)
self.resume.change(
fn=lambda path: gr.Dropdown().update(choices=list_state_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_state_dirs(path)),
inputs=self.resume,
outputs=self.resume,
show_progress=False,
Expand Down
6 changes: 3 additions & 3 deletions kohya_gui/class_configuration_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, headless=False, output_dir: gr.Dropdown = None):

def update_configs(output_dir):
self.output_dir = output_dir
return gr.Dropdown().update(choices=list(list_files(output_dir, exts=[".json"], all=True)))
return gr.Dropdown().update(choices=[""] + list(list_files(output_dir, exts=[".json"], all=True)))

def list_configs(path):
self.output_dir = path
Expand All @@ -23,7 +23,7 @@ def list_configs(path):
with gr.Row():
self.config_file_name = gr.Dropdown(
label='Load/Save Config file',
choices=list_configs(self.output_dir),
choices=[""] + list_configs(self.output_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand All @@ -47,7 +47,7 @@ def list_configs(path):
)

self.config_file_name.change(
fn=lambda path: gr.Dropdown().update(choices=list_configs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_configs(path)),
inputs=self.config_file_name,
outputs=self.config_file_name,
show_progress=False,
Expand Down
12 changes: 6 additions & 6 deletions kohya_gui/class_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def list_logging_dirs(path):
with gr.Row():
self.output_dir = gr.Dropdown(
label=f'Output folder to output trained model',
choices=list_output_dirs(default_output_dir),
choices=[""] + list_output_dirs(default_output_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand All @@ -58,7 +58,7 @@ def list_logging_dirs(path):

self.reg_data_dir = gr.Dropdown(
label='Regularisation folder (Optional. containing reqularization images)' if not finetune else 'Train config folder (Optional. where config files will be saved)',
choices=list_data_dirs(default_reg_data_dir),
choices=[""] + list_data_dirs(default_reg_data_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand All @@ -75,7 +75,7 @@ def list_logging_dirs(path):
with gr.Row():
self.logging_dir = gr.Dropdown(
label='Logging folder (Optional. to enable logging and output Tensorboard log)',
choices=list_logging_dirs(default_logging_dir),
choices=[""] + list_logging_dirs(default_logging_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand All @@ -91,19 +91,19 @@ def list_logging_dirs(path):
)

self.output_dir.change(
fn=lambda path: gr.Dropdown().update(choices=list_output_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_output_dirs(path)),
inputs=self.output_dir,
outputs=self.output_dir,
show_progress=False,
)
self.reg_data_dir.change(
fn=lambda path: gr.Dropdown().update(choices=list_data_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_data_dirs(path)),
inputs=self.reg_data_dir,
outputs=self.reg_data_dir,
show_progress=False,
)
self.logging_dir.change(
fn=lambda path: gr.Dropdown().update(choices=list_logging_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_logging_dirs(path)),
inputs=self.logging_dir,
outputs=self.logging_dir,
show_progress=False,
Expand Down
4 changes: 2 additions & 2 deletions kohya_gui/class_source_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def list_train_dirs(path):
with gr.Column(), gr.Row():
self.train_data_dir = gr.Dropdown(
label='Image folder (containing training images subfolders)' if not finetuning else 'Image folder (containing training images)',
choices=list_train_dirs(default_train_dir),
choices=[""] + list_train_dirs(default_train_dir),
value="",
interactive=True,
allow_custom_value=True,
Expand Down Expand Up @@ -182,7 +182,7 @@ def list_train_dirs(path):
)

self.train_data_dir.change(
fn=lambda path: gr.Dropdown().update(choices=list_train_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_train_dirs(path)),
inputs=self.train_data_dir,
outputs=self.train_data_dir,
show_progress=False,
Expand Down
8 changes: 4 additions & 4 deletions kohya_gui/convert_lcm_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def list_save_to(path):
model_path = gr.Dropdown(
label="Stable Diffusion model to convert to LCM",
interactive=True,
choices=list_models(current_model_dir),
choices=[""] + list_models(current_model_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -115,7 +115,7 @@ def list_save_to(path):
name = gr.Dropdown(
label="Name of the new LCM model",
interactive=True,
choices=list_save_to(current_save_dir),
choices=[""] + list_save_to(current_save_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -133,13 +133,13 @@ def list_save_to(path):
show_progress=False,
)
model_path.change(
fn=lambda path: gr.Dropdown().update(choices=list_models(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_models(path)),
inputs=model_path,
outputs=model_path,
show_progress=False,
)
name.change(
fn=lambda path: gr.Dropdown().update(choices=list_save_to(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_save_to(path)),
inputs=name,
outputs=name,
show_progress=False,
Expand Down
8 changes: 4 additions & 4 deletions kohya_gui/convert_model_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def list_target_folder(path):
source_model_input = gr.Dropdown(
label='Source model (path to source model folder of file to convert...)',
interactive=True,
choices=list_source_model(default_source_model),
choices=[""] + list_source_model(default_source_model),
value="",
allow_custom_value=True,
)
Expand Down Expand Up @@ -233,7 +233,7 @@ def list_target_folder(path):
)

source_model_input.change(
fn=lambda path: gr.Dropdown().update(choices=list_source_model(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_source_model(path)),
inputs=source_model_input,
outputs=source_model_input,
show_progress=False,
Expand All @@ -255,7 +255,7 @@ def list_target_folder(path):
target_model_folder_input = gr.Dropdown(
label='Target model folder (path to target model folder of file name to create...)',
interactive=True,
choices=list_target_folder(default_target_folder),
choices=[""] + list_target_folder(default_target_folder),
value="",
allow_custom_value=True,
)
Expand All @@ -273,7 +273,7 @@ def list_target_folder(path):
)

target_model_folder_input.change(
fn=lambda path: gr.Dropdown().update(choices=list_target_folder(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_target_folder(path)),
inputs=target_model_folder_input,
outputs=target_model_folder_input,
show_progress=False,
Expand Down
6 changes: 3 additions & 3 deletions kohya_gui/dataset_balancing_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def list_dataset_dirs(path):
select_dataset_folder_input = gr.Dropdown(
label='Dataset folder (folder containing the concepts folders to balance...)',
interactive=True,
choices=list_dataset_dirs(current_dataset_dir),
choices=[""] + list_dataset_dirs(current_dataset_dir),
value="",
allow_custom_value=True,
)
create_refresh_button(select_dataset_folder_input, lambda: None, lambda: {"choices": list_dataset_dir(current_dataset_dir)}, "open_folder_small")
create_refresh_button(select_dataset_folder_input, lambda: None, lambda: {"choices": list_dataset_dirs(current_dataset_dir)}, "open_folder_small")
select_dataset_folder_button = gr.Button(
'📂', elem_id='open_folder_small', elem_classes=['tool'], visible=(not headless)
)
Expand All @@ -150,7 +150,7 @@ def list_dataset_dirs(path):
label='Training steps per concept per epoch',
)
select_dataset_folder_input.change(
fn=lambda path: gr.Dropdown().update(choices=list_dataset_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_dataset_dirs(path)),
inputs=select_dataset_folder_input,
outputs=select_dataset_folder_input,
show_progress=False,
Expand Down
14 changes: 7 additions & 7 deletions kohya_gui/dreambooth_folder_creation_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,11 @@ def list_train_data_dirs(path):
util_training_images_dir_input = gr.Dropdown(
label='Training images (directory containing the training images)',
interactive=True,
choices=list_train_data_dirs(current_train_data_dir),
choices=[""] + list_train_data_dirs(current_train_data_dir),
value="",
allow_custom_value=True,
)
create_refresh_button(util_training_images_dir_input, lambda: None, lambda: {"choices": list_train_data_dir(current_train_data_dir)}, "open_folder_small")
create_refresh_button(util_training_images_dir_input, lambda: None, lambda: {"choices": list_train_data_dirs(current_train_data_dir)}, "open_folder_small")
button_util_training_images_dir_input = gr.Button(
'📂', elem_id='open_folder_small', elem_classes=['tool'], visible=(not headless)
)
Expand All @@ -175,7 +175,7 @@ def list_train_data_dirs(path):
elem_id='number_input',
)
util_training_images_dir_input.change(
fn=lambda path: gr.Dropdown().update(choices=list_train_data_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_train_data_dirs(path)),
inputs=util_training_images_dir_input,
outputs=util_training_images_dir_input,
show_progress=False,
Expand All @@ -190,7 +190,7 @@ def list_reg_data_dirs(path):
util_regularization_images_dir_input = gr.Dropdown(
label='Regularisation images (Optional. directory containing the regularisation images)',
interactive=True,
choices=list_reg_data_dirs(current_reg_data_dir),
choices=[""] + list_reg_data_dirs(current_reg_data_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -210,7 +210,7 @@ def list_reg_data_dirs(path):
elem_id='number_input',
)
util_regularization_images_dir_input.change(
fn=lambda path: gr.Dropdown().update(choices=list_reg_data_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_reg_data_dirs(path)),
inputs=util_regularization_images_dir_input,
outputs=util_regularization_images_dir_input,
show_progress=False,
Expand All @@ -224,7 +224,7 @@ def list_train_output_dirs(path):
util_training_dir_output = gr.Dropdown(
label='Destination training directory (where formatted training and regularisation folders will be placed)',
interactive=True,
choices=list_train_output_dirs(current_train_output_dir),
choices=[""] + list_train_output_dirs(current_train_output_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -236,7 +236,7 @@ def list_train_output_dirs(path):
get_folder_path, outputs=util_training_dir_output
)
util_training_dir_output.change(
fn=lambda path: gr.Dropdown().update(choices=list_train_output_dirs(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_train_output_dirs(path)),
inputs=util_training_dir_output,
outputs=util_training_dir_output,
show_progress=False,
Expand Down
4 changes: 2 additions & 2 deletions kohya_gui/dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,8 @@ def train_model(
# Saving config file for model
current_datetime = datetime.now()
formatted_datetime = current_datetime.strftime("%Y%m%d-%H%M%S")
config_dir = os.path.dirname(os.path.dirname(train_data_dir))
file_path = os.path.join(config_dir, f"{output_name}_{formatted_datetime}.json")
# config_dir = os.path.dirname(os.path.dirname(train_data_dir))
file_path = os.path.join(output_dir, f"{output_name}_{formatted_datetime}.json")

log.info(f"Saving training config to {file_path}...")

Expand Down
8 changes: 4 additions & 4 deletions kohya_gui/extract_lora_from_dylora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def list_save_to(path):
model = gr.Dropdown(
label='DyLoRA model (path to the DyLoRA model to extract from)',
interactive=True,
choices=list_models(current_model_dir),
choices=[""] + list_models(current_model_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -119,7 +119,7 @@ def list_save_to(path):
save_to = gr.Dropdown(
label='Save to (path where to save the extracted LoRA model...)',
interactive=True,
choices=list_save_to(current_save_dir),
choices=[""] + list_save_to(current_save_dir),
value="",
allow_custom_value=True,
)
Expand All @@ -134,13 +134,13 @@ def list_save_to(path):
)

model.change(
fn=lambda path: gr.Dropdown().update(choices=list_models(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_models(path)),
inputs=model,
outputs=model,
show_progress=False,
)
save_to.change(
fn=lambda path: gr.Dropdown().update(choices=list_save_to(path)),
fn=lambda path: gr.Dropdown().update(choices=[""] + list_save_to(path)),
inputs=save_to,
outputs=save_to,
show_progress=False,
Expand Down
Loading

0 comments on commit 7dae63e

Please sign in to comment.