diff --git a/.release b/.release index 698f8983e..0ba9aef02 100644 --- a/.release +++ b/.release @@ -1 +1 @@ -v23.0.0 +v23.0.1 diff --git a/README.md b/README.md index ce924ea1f..1a4205650 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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) diff --git a/kohya_gui/basic_caption_gui.py b/kohya_gui/basic_caption_gui.py index ad5ee6497..d064ee646 100644 --- a/kohya_gui/basic_caption_gui.py +++ b/kohya_gui/basic_caption_gui.py @@ -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, @@ -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, diff --git a/kohya_gui/blip_caption_gui.py b/kohya_gui/blip_caption_gui.py index 225c7fe27..df1004a30 100644 --- a/kohya_gui/blip_caption_gui.py +++ b/kohya_gui/blip_caption_gui.py @@ -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, @@ -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, diff --git a/kohya_gui/class_advanced_training.py b/kohya_gui/class_advanced_training.py index 41581314d..bc4adc278 100644 --- a/kohya_gui/class_advanced_training.py +++ b/kohya_gui/class_advanced_training.py @@ -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, ) @@ -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, @@ -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, @@ -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, diff --git a/kohya_gui/class_configuration_file.py b/kohya_gui/class_configuration_file.py index 890264c11..68420bf3b 100644 --- a/kohya_gui/class_configuration_file.py +++ b/kohya_gui/class_configuration_file.py @@ -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 @@ -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, @@ -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, diff --git a/kohya_gui/class_folders.py b/kohya_gui/class_folders.py index 1b9e4aae4..81558c29b 100644 --- a/kohya_gui/class_folders.py +++ b/kohya_gui/class_folders.py @@ -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, @@ -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, @@ -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, @@ -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, diff --git a/kohya_gui/class_source_model.py b/kohya_gui/class_source_model.py index 9ba55d82c..9017fcfa7 100644 --- a/kohya_gui/class_source_model.py +++ b/kohya_gui/class_source_model.py @@ -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, @@ -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, diff --git a/kohya_gui/convert_lcm_gui.py b/kohya_gui/convert_lcm_gui.py index 7211ff295..8073c1dfa 100644 --- a/kohya_gui/convert_lcm_gui.py +++ b/kohya_gui/convert_lcm_gui.py @@ -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, ) @@ -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, ) @@ -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, diff --git a/kohya_gui/convert_model_gui.py b/kohya_gui/convert_model_gui.py index bdaa7b859..b457c5c68 100644 --- a/kohya_gui/convert_model_gui.py +++ b/kohya_gui/convert_model_gui.py @@ -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, ) @@ -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, @@ -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, ) @@ -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, diff --git a/kohya_gui/dataset_balancing_gui.py b/kohya_gui/dataset_balancing_gui.py index 62cf3ad8d..50ba533df 100644 --- a/kohya_gui/dataset_balancing_gui.py +++ b/kohya_gui/dataset_balancing_gui.py @@ -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) ) @@ -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, diff --git a/kohya_gui/dreambooth_folder_creation_gui.py b/kohya_gui/dreambooth_folder_creation_gui.py index 174d421c6..b7dde8e34 100644 --- a/kohya_gui/dreambooth_folder_creation_gui.py +++ b/kohya_gui/dreambooth_folder_creation_gui.py @@ -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) ) @@ -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, @@ -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, ) @@ -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, @@ -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, ) @@ -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, diff --git a/kohya_gui/dreambooth_gui.py b/kohya_gui/dreambooth_gui.py index 14d74f700..981a8bfb1 100644 --- a/kohya_gui/dreambooth_gui.py +++ b/kohya_gui/dreambooth_gui.py @@ -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}...") diff --git a/kohya_gui/extract_lora_from_dylora_gui.py b/kohya_gui/extract_lora_from_dylora_gui.py index 66d0155fc..bbbce2402 100644 --- a/kohya_gui/extract_lora_from_dylora_gui.py +++ b/kohya_gui/extract_lora_from_dylora_gui.py @@ -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, ) @@ -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, ) @@ -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, diff --git a/kohya_gui/extract_lora_gui.py b/kohya_gui/extract_lora_gui.py index 1a5d29d51..561de5dce 100644 --- a/kohya_gui/extract_lora_gui.py +++ b/kohya_gui/extract_lora_gui.py @@ -146,7 +146,7 @@ def change_sdxl(sdxl): model_tuned = gr.Dropdown( label='Finetuned model (path to the finetuned model to extract)', interactive=True, - choices=list_models(current_model_dir), + choices=[""] + list_models(current_model_dir), value="", allow_custom_value=True, ) @@ -174,7 +174,7 @@ def change_sdxl(sdxl): model_org = gr.Dropdown( label='Stable Diffusion base model (original model: ckpt or safetensors file)', interactive=True, - choices=list_org_models(current_model_org_dir), + choices=[""] + list_org_models(current_model_org_dir), value="", allow_custom_value=True, ) @@ -203,7 +203,7 @@ def change_sdxl(sdxl): 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, scale=2, @@ -235,19 +235,19 @@ def change_sdxl(sdxl): ) model_tuned.change( - fn=lambda path: gr.Dropdown().update(choices=list_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_models(path)), inputs=model_tuned, outputs=model_tuned, show_progress=False, ) model_org.change( - fn=lambda path: gr.Dropdown().update(choices=list_org_model(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_org_model(path)), inputs=model_org, outputs=model_org, 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, diff --git a/kohya_gui/extract_lycoris_locon_gui.py b/kohya_gui/extract_lycoris_locon_gui.py index 1af8afede..1ad4b3ab6 100644 --- a/kohya_gui/extract_lycoris_locon_gui.py +++ b/kohya_gui/extract_lycoris_locon_gui.py @@ -181,7 +181,7 @@ def list_save_to(path): db_model = gr.Dropdown( label="Finetuned model (path to the finetuned model to extract)", interactive=True, - choices=list_models(current_model_dir), + choices=[""] + list_models(current_model_dir), value="", allow_custom_value=True, ) @@ -201,7 +201,7 @@ def list_save_to(path): base_model = gr.Dropdown( label="Stable Diffusion base model (original model: ckpt or safetensors file)", - choices=list_base_models(current_base_model_dir), + choices=[""] + list_base_models(current_base_model_dir), value="", allow_custom_value=True, ) @@ -222,7 +222,7 @@ def list_save_to(path): output_name = 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, scale=2, @@ -252,19 +252,19 @@ def list_save_to(path): ) db_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_models(path)), inputs=db_model, outputs=db_model, show_progress=False, ) base_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_base_model(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_base_model(path)), inputs=base_model, outputs=base_model, show_progress=False, ) output_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=output_name, outputs=output_name, show_progress=False, diff --git a/kohya_gui/finetune_gui.py b/kohya_gui/finetune_gui.py index 01fdd1957..3cb2470c6 100644 --- a/kohya_gui/finetune_gui.py +++ b/kohya_gui/finetune_gui.py @@ -692,8 +692,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_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}...") @@ -757,7 +757,7 @@ def list_presets(path): training_preset = gr.Dropdown( label="Presets", - choices=list_presets(f"{presets_dir}/finetune"), + choices=[""] + list_presets(f"{presets_dir}/finetune"), elem_id="myDropdown", ) diff --git a/kohya_gui/git_caption_gui.py b/kohya_gui/git_caption_gui.py index ea0ae2a26..701fb0e3e 100644 --- a/kohya_gui/git_caption_gui.py +++ b/kohya_gui/git_caption_gui.py @@ -87,12 +87,12 @@ 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, ) - create_refresh_button(train_data_dir, lambda: None, lambda: {"choices": list_train_dir(current_train_dir)},"open_folder_small") + create_refresh_button(train_data_dir, lambda: None, lambda: {"choices": list_train_dirs(current_train_dir)},"open_folder_small") button_train_data_dir_input = gr.Button( '📂', elem_id='open_folder_small', elem_classes=['tool'], visible=(not headless) ) @@ -156,7 +156,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, diff --git a/kohya_gui/group_images_gui.py b/kohya_gui/group_images_gui.py index 2c8a86985..ae4a18757 100644 --- a/kohya_gui/group_images_gui.py +++ b/kohya_gui/group_images_gui.py @@ -81,11 +81,11 @@ def list_output_dirs(path): input_folder = gr.Dropdown( label='Input folder (containing the images to group)', interactive=True, - choices=list_input_dirs(current_input_folder), + choices=[""] + list_input_dirs(current_input_folder), value="", allow_custom_value=True, ) - create_refresh_button(input_folder, lambda: None, lambda: {"choices": list_input_dirs(current_input_dir)},"open_folder_small") + create_refresh_button(input_folder, lambda: None, lambda: {"choices": list_input_dirs(current_input_folder)},"open_folder_small") button_input_folder = gr.Button( '📂', elem_id='open_folder_small', elem_classes=['tool'], visible=(not headless) ) @@ -98,7 +98,7 @@ def list_output_dirs(path): output_folder = gr.Dropdown( label='Output folder (where the grouped images will be stored)', interactive=True, - choices=list_output_dirs(current_output_folder), + choices=[""] + list_output_dirs(current_output_folder), value="", allow_custom_value=True, ) @@ -113,13 +113,13 @@ def list_output_dirs(path): ) input_folder.change( - fn=lambda path: gr.Dropdown().update(choices=list_input_dirs(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_input_dirs(path)), inputs=input_folder, outputs=input_folder, show_progress=False, ) output_folder.change( - fn=lambda path: gr.Dropdown().update(choices=list_output_dirs(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_output_dirs(path)), inputs=output_folder, outputs=output_folder, show_progress=False, diff --git a/kohya_gui/lora_gui.py b/kohya_gui/lora_gui.py index 39d3fc1d0..16c3162d1 100644 --- a/kohya_gui/lora_gui.py +++ b/kohya_gui/lora_gui.py @@ -1017,8 +1017,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}...") @@ -1096,7 +1096,7 @@ def list_presets(path): training_preset = gr.Dropdown( label="Presets", - choices=list_presets(fr"{presets_dir}/lora"), + choices=[""] + list_presets(fr"{presets_dir}/lora"), elem_id="myDropdown", value="none" ) diff --git a/kohya_gui/manual_caption_gui.py b/kohya_gui/manual_caption_gui.py index c031da91c..778305068 100644 --- a/kohya_gui/manual_caption_gui.py +++ b/kohya_gui/manual_caption_gui.py @@ -286,7 +286,7 @@ def list_images_dirs(path): with gr.Group(), gr.Row(): 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, @@ -312,7 +312,7 @@ def list_images_dirs(path): ) 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, diff --git a/kohya_gui/merge_lora_gui.py b/kohya_gui/merge_lora_gui.py index 7a8d40083..85963de35 100644 --- a/kohya_gui/merge_lora_gui.py +++ b/kohya_gui/merge_lora_gui.py @@ -108,7 +108,7 @@ def list_save_to(path): sd_model = gr.Dropdown( label='SD Model (Optional. Stable Diffusion model path, if you want to merge it with LoRA files)', interactive=True, - choices=list_sd_models(current_sd_model_dir), + choices=[""] + list_sd_models(current_sd_model_dir), value="", allow_custom_value=True, ) @@ -128,7 +128,7 @@ def list_save_to(path): sdxl_model = gr.Checkbox(label='SDXL model', value=False) sd_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_sd_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_sd_models(path)), inputs=sd_model, outputs=sd_model, show_progress=False, @@ -138,7 +138,7 @@ def list_save_to(path): lora_a_model = gr.Dropdown( label='LoRA model "A" (path to the LoRA A model)', interactive=True, - choices=list_a_models(current_a_model_dir), + choices=[""] + list_a_models(current_a_model_dir), value="", allow_custom_value=True, ) @@ -159,7 +159,7 @@ def list_save_to(path): lora_b_model = gr.Dropdown( label='LoRA model "B" (path to the LoRA B model)', interactive=True, - choices=list_b_models(current_b_model_dir), + choices=[""] + list_b_models(current_b_model_dir), value="", allow_custom_value=True, ) @@ -178,13 +178,13 @@ def list_save_to(path): ) lora_a_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_a_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_a_models(path)), inputs=lora_a_model, outputs=lora_a_model, show_progress=False, ) lora_b_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_b_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_b_models(path)), inputs=lora_b_model, outputs=lora_b_model, show_progress=False, @@ -213,7 +213,7 @@ def list_save_to(path): lora_c_model = gr.Dropdown( label='LoRA model "C" (path to the LoRA C model)', interactive=True, - choices=list_c_models(current_c_model_dir), + choices=[""] + list_c_models(current_c_model_dir), value="", allow_custom_value=True, ) @@ -234,7 +234,7 @@ def list_save_to(path): lora_d_model = gr.Dropdown( label='LoRA model "D" (path to the LoRA D model)', interactive=True, - choices=list_d_models(current_d_model_dir), + choices=[""] + list_d_models(current_d_model_dir), value="", allow_custom_value=True, ) @@ -252,13 +252,13 @@ def list_save_to(path): show_progress=False, ) lora_c_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_c_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_c_models(path)), inputs=lora_c_model, outputs=lora_c_model, show_progress=False, ) lora_d_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_d_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_d_models(path)), inputs=lora_d_model, outputs=lora_d_model, show_progress=False, @@ -287,7 +287,7 @@ def list_save_to(path): save_to = gr.Dropdown( label='Save to (path for the file to save...)', interactive=True, - choices=list_save_to(current_d_model_dir), + choices=[""] + list_save_to(current_d_model_dir), value="", allow_custom_value=True, ) @@ -318,7 +318,7 @@ def list_save_to(path): ) 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, diff --git a/kohya_gui/merge_lycoris_gui.py b/kohya_gui/merge_lycoris_gui.py index 64e4a335b..42cf28926 100644 --- a/kohya_gui/merge_lycoris_gui.py +++ b/kohya_gui/merge_lycoris_gui.py @@ -99,7 +99,7 @@ def list_save_to(path): label='SD Model (Optional Stable Diffusion base model)', interactive=True, info='Provide a SD file path that you want to merge with the LyCORIS file', - choices=list_models(current_save_dir), + choices=[""] + list_models(current_save_dir), value="", allow_custom_value=True, ) @@ -135,13 +135,13 @@ def list_save_to(path): ) base_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_models(path)), inputs=base_model, outputs=base_model, show_progress=False, ) lycoris_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_lycoris_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_lycoris_models(path)), inputs=lycoris_model, outputs=lycoris_model, show_progress=False, @@ -161,7 +161,7 @@ def list_save_to(path): output_name = gr.Dropdown( label='Save to (path for the checkpoint file to save...)', interactive=True, - choices=list_save_to(current_save_dir), + choices=[""] + list_save_to(current_save_dir), value="", allow_custom_value=True, ) @@ -203,7 +203,7 @@ def list_save_to(path): ) output_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=output_name, outputs=output_name, show_progress=False, diff --git a/kohya_gui/resize_lora_gui.py b/kohya_gui/resize_lora_gui.py index c68457e3e..3ceb7ffcc 100644 --- a/kohya_gui/resize_lora_gui.py +++ b/kohya_gui/resize_lora_gui.py @@ -111,7 +111,7 @@ def list_save_to(path): model = gr.Dropdown( label='Source LoRA (path to the LoRA to resize)', interactive=True, - choices=list_models(current_model_dir), + choices=[""] + list_models(current_model_dir), value="", allow_custom_value=True, ) @@ -131,7 +131,7 @@ def list_save_to(path): save_to = gr.Dropdown( label='Save to (path for the LoRA file to save...)', interactive=True, - choices=list_save_to(current_save_dir), + choices=[""] + list_save_to(current_save_dir), value="", allow_custom_value=True, ) @@ -149,13 +149,13 @@ def list_save_to(path): show_progress=False, ) 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, diff --git a/kohya_gui/svd_merge_lora_gui.py b/kohya_gui/svd_merge_lora_gui.py index 2730c09fc..bf577777f 100644 --- a/kohya_gui/svd_merge_lora_gui.py +++ b/kohya_gui/svd_merge_lora_gui.py @@ -150,7 +150,7 @@ def list_save_to(path): lora_a_model = gr.Dropdown( label='LoRA model "A" (path to the LoRA A model)', interactive=True, - choices=list_a_models(current_a_model_dir), + choices=[""] + list_a_models(current_a_model_dir), value="", allow_custom_value=True, ) @@ -171,7 +171,7 @@ def list_save_to(path): lora_b_model = gr.Dropdown( label='LoRA model "B" (path to the LoRA B model)', interactive=True, - choices=list_b_models(current_b_model_dir), + choices=[""] + list_b_models(current_b_model_dir), value="", allow_custom_value=True, ) @@ -189,13 +189,13 @@ def list_save_to(path): show_progress=False, ) lora_a_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_a_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_a_models(path)), inputs=lora_a_model, outputs=lora_a_model, show_progress=False, ) lora_b_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_b_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_b_models(path)), inputs=lora_b_model, outputs=lora_b_model, show_progress=False, @@ -221,7 +221,7 @@ def list_save_to(path): lora_c_model = gr.Dropdown( label='LoRA model "C" (path to the LoRA C model)', interactive=True, - choices=list_c_models(current_c_model_dir), + choices=[""] + list_c_models(current_c_model_dir), value="", allow_custom_value=True, ) @@ -242,7 +242,7 @@ def list_save_to(path): lora_d_model = gr.Dropdown( label='LoRA model "D" (path to the LoRA D model)', interactive=True, - choices=list_d_models(current_d_model_dir), + choices=[""] + list_d_models(current_d_model_dir), value="", allow_custom_value=True, ) @@ -261,13 +261,13 @@ def list_save_to(path): ) lora_c_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_c_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_c_models(path)), inputs=lora_c_model, outputs=lora_c_model, show_progress=False, ) lora_d_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_d_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_d_models(path)), inputs=lora_d_model, outputs=lora_d_model, show_progress=False, @@ -311,7 +311,7 @@ def list_save_to(path): save_to = gr.Dropdown( label='Save to (path for the new LoRA file to save...)', interactive=True, - choices=list_save_to(current_d_model_dir), + choices=[""] + list_save_to(current_d_model_dir), value="", allow_custom_value=True, ) @@ -329,7 +329,7 @@ def list_save_to(path): 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, diff --git a/kohya_gui/textual_inversion_gui.py b/kohya_gui/textual_inversion_gui.py index d8a594b4e..50674603f 100644 --- a/kohya_gui/textual_inversion_gui.py +++ b/kohya_gui/textual_inversion_gui.py @@ -667,8 +667,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}...") @@ -730,7 +730,7 @@ def list_embedding_files(path): weights = gr.Dropdown( label='Resume TI training (Optional. Path to existing TI embedding file to keep training)', - choices=list_embedding_files(current_embedding_dir), + choices=[""] + list_embedding_files(current_embedding_dir), value="", interactive=True, allow_custom_value=True, @@ -748,7 +748,7 @@ def list_embedding_files(path): show_progress=False, ) weights.change( - fn=lambda path: gr.Dropdown().update(choices=list_embedding_files(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_embedding_files(path)), inputs=weights, outputs=weights, show_progress=False, diff --git a/kohya_gui/verify_lora_gui.py b/kohya_gui/verify_lora_gui.py index 874cb9e76..7c8fdefa3 100644 --- a/kohya_gui/verify_lora_gui.py +++ b/kohya_gui/verify_lora_gui.py @@ -79,7 +79,7 @@ def list_models(path): lora_model = gr.Dropdown( label='LoRA model (path to the LoRA model to verify)', interactive=True, - choices=list_models(current_model_dir), + choices=[""] + list_models(current_model_dir), value="", allow_custom_value=True, ) @@ -99,7 +99,7 @@ def list_models(path): verify_button = gr.Button('Verify', variant='primary') lora_model.change( - fn=lambda path: gr.Dropdown().update(choices=list_models(path)), + fn=lambda path: gr.Dropdown().update(choices=[""] + list_models(path)), inputs=lora_model, outputs=lora_model, show_progress=False, diff --git a/kohya_gui/wd14_caption_gui.py b/kohya_gui/wd14_caption_gui.py index b65aa0d8f..6c5095f75 100644 --- a/kohya_gui/wd14_caption_gui.py +++ b/kohya_gui/wd14_caption_gui.py @@ -115,12 +115,12 @@ 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, ) - create_refresh_button(train_data_dir, lambda: None, lambda: {"choices": list_train_dir(current_train_dir)},"open_folder_small") + create_refresh_button(train_data_dir, lambda: None, lambda: {"choices": list_train_dirs(current_train_dir)},"open_folder_small") button_train_data_dir_input = gr.Button( '📂', elem_id='open_folder_small', elem_classes=['tool'], visible=(not headless) ) @@ -274,7 +274,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, diff --git a/requirements_windows_torch2.txt b/requirements_windows_torch2.txt index 9bcbf81ed..e5e5d5be7 100644 --- a/requirements_windows_torch2.txt +++ b/requirements_windows_torch2.txt @@ -1,7 +1,7 @@ torch==2.1.2+cu118 torchvision==0.16.2+cu118 torchaudio==2.1.2+cu118 xformers==0.0.23.post1+cu118 --index-url https://download.pytorch.org/whl/cu118 nvidia-cudnn-cu11==8.9.5.29 -https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl # no_verify +# https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.2.post2-py3-none-win_amd64.whl # no_verify # https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.41.1-py3-none-win_amd64.whl # no_verify -# bitsandbytes==0.41.1 +bitsandbytes==0.43.0 tensorboard==2.14.1 tensorflow==2.14.0 -r requirements.txt diff --git a/test/config/Standard-AdamW8bit.json b/test/config/Standard-AdamW8bit.json new file mode 100644 index 000000000..f151dcad6 --- /dev/null +++ b/test/config/Standard-AdamW8bit.json @@ -0,0 +1,125 @@ +{ + "LoRA_type": "Standard", + "LyCORIS_preset": "full", + "adaptive_noise_scale": 0, + "additional_parameters": "", + "block_alphas": "", + "block_dims": "", + "block_lr_zero_threshold": "", + "bucket_no_upscale": true, + "bucket_reso_steps": 1, + "cache_latents": true, + "cache_latents_to_disk": false, + "caption_dropout_every_n_epochs": 0.0, + "caption_dropout_rate": 0.05, + "caption_extension": "", + "clip_skip": 2, + "color_aug": false, + "constrain": 0.0, + "conv_alpha": 8, + "conv_block_alphas": "", + "conv_block_dims": "", + "conv_dim": 16, + "debiased_estimation_loss": false, + "decompose_both": false, + "dim_from_weights": false, + "down_lr_weight": "", + "enable_bucket": true, + "epoch": 4, + "factor": -1, + "flip_aug": false, + "fp8_base": false, + "full_bf16": false, + "full_fp16": false, + "gpu_ids": "", + "gradient_accumulation_steps": 1, + "gradient_checkpointing": false, + "keep_tokens": "0", + "learning_rate": 0.0001, + "logging_dir": "./test/logs", + "lora_network_weights": "", + "lr_scheduler": "cosine", + "lr_scheduler_args": "", + "lr_scheduler_num_cycles": "", + "lr_scheduler_power": "", + "lr_warmup": 0, + "max_bucket_reso": 2048, + "max_data_loader_n_workers": "0", + "max_grad_norm": 1, + "max_resolution": "512,512", + "max_timestep": 1000, + "max_token_length": "75", + "max_train_epochs": "", + "max_train_steps": "", + "mem_eff_attn": false, + "mid_lr_weight": "", + "min_bucket_reso": 256, + "min_snr_gamma": 10, + "min_timestep": 0, + "mixed_precision": "bf16", + "model_list": "runwayml/stable-diffusion-v1-5", + "module_dropout": 0.1, + "multi_gpu": false, + "multires_noise_discount": 0.2, + "multires_noise_iterations": 8, + "network_alpha": 16, + "network_dim": 16, + "network_dropout": 0.1, + "noise_offset": "0.05", + "noise_offset_type": "Multires", + "num_cpu_threads_per_process": 2, + "num_machines": 1, + "num_processes": 1, + "optimizer": "AdamW8bit", + "optimizer_args": "", + "output_dir": "./test/output", + "output_name": "Standard-Adamw8bit", + "persistent_data_loader_workers": false, + "pretrained_model_name_or_path": "runwayml/stable-diffusion-v1-5", + "prior_loss_weight": 1.0, + "random_crop": false, + "rank_dropout": 0.1, + "rank_dropout_scale": false, + "reg_data_dir": "", + "rescaled": false, + "resume": "", + "sample_every_n_epochs": 0, + "sample_every_n_steps": 20, + "sample_prompts": "a painting of man wearing a gas mask , by darius kawasaki", + "sample_sampler": "euler_a", + "save_every_n_epochs": 1, + "save_every_n_steps": 0, + "save_last_n_steps": 0, + "save_last_n_steps_state": 0, + "save_model_as": "safetensors", + "save_precision": "fp16", + "save_state": false, + "scale_v_pred_loss_like_noise_pred": false, + "scale_weight_norms": 1, + "sdxl": false, + "sdxl_cache_text_encoder_outputs": false, + "sdxl_no_half_vae": false, + "seed": "1234", + "shuffle_caption": false, + "stop_text_encoder_training": 0, + "text_encoder_lr": 0.0001, + "train_batch_size": 4, + "train_data_dir": "./test/img", + "train_norm": false, + "train_on_input": false, + "training_comment": "", + "unet_lr": 0.0001, + "unit": 1, + "up_lr_weight": "", + "use_cp": true, + "use_scalar": false, + "use_tucker": false, + "use_wandb": false, + "v2": false, + "v_parameterization": false, + "v_pred_like_loss": 0, + "vae_batch_size": 0, + "wandb_api_key": "", + "weighted_captions": false, + "xformers": "xformers" +} \ No newline at end of file