Skip to content

Commit

Permalink
Fix bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
bmaltais committed Apr 17, 2024
1 parent a1dae68 commit 1898851
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 175 deletions.
2 changes: 1 addition & 1 deletion kohya_gui/class_tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ def gradio_interface(self):
self.stop_tensorboard,
outputs=[button_start_tensorboard, button_stop_tensorboard],
show_progress=False,
)
)
26 changes: 7 additions & 19 deletions kohya_gui/dreambooth_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,12 @@ def train_model(
vae=vae,
dataset_config=dataset_config,
):
return
return TRAIN_BUTTON_VISIBLE

if not print_only and check_if_model_exist(
output_name, output_dir, save_model_as, headless=headless
):
return
return TRAIN_BUTTON_VISIBLE

if dataset_config:
log.info(
Expand Down Expand Up @@ -934,25 +934,13 @@ def dreambooth_tab(
"Stop training", visible=False, variant="stop"
)

button_print = gr.Button("Print training command")
with gr.Column(), gr.Group():
with gr.Row():
button_print = gr.Button("Print training command")

# Setup gradio tensorboard buttons
with gr.Column(), gr.Group():
(
button_start_tensorboard,
button_stop_tensorboard,
) = gradio_tensorboard()

button_start_tensorboard.click(
start_tensorboard,
inputs=[dummy_headless, folders.logging_dir],
show_progress=False,
)

button_stop_tensorboard.click(
stop_tensorboard,
show_progress=False,
)
TensorboardManager(headless=headless, logging_dir=folders.logging_dir)

settings_list = [
source_model.pretrained_model_name_or_path,
Expand Down Expand Up @@ -1142,4 +1130,4 @@ def dreambooth_tab(
folders.reg_data_dir,
folders.output_dir,
folders.logging_dir,
)
)
25 changes: 7 additions & 18 deletions kohya_gui/finetune_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,12 @@ def train_model(
resume=resume,
dataset_config=dataset_config,
):
return
return TRAIN_BUTTON_VISIBLE

if not print_only and check_if_model_exist(
output_name, output_dir, save_model_as, headless
):
return
return TRAIN_BUTTON_VISIBLE

if dataset_config:
log.info(
Expand Down Expand Up @@ -1086,24 +1086,13 @@ def list_presets(path):
"Stop training", visible=False, variant="stop"
)

button_print = gr.Button("Print training command")
with gr.Column(), gr.Group():
with gr.Row():
button_print = gr.Button("Print training command")

# Setup gradio tensorboard buttons
with gr.Column(), gr.Group():
(
button_start_tensorboard,
button_stop_tensorboard,
) = gradio_tensorboard()

button_start_tensorboard.click(
start_tensorboard,
inputs=[dummy_headless, logging_dir],
)

button_stop_tensorboard.click(
stop_tensorboard,
show_progress=False,
)
TensorboardManager(headless=headless, logging_dir=folders.logging_dir)

settings_list = [
source_model.pretrained_model_name_or_path,
Expand Down Expand Up @@ -1323,4 +1312,4 @@ def list_presets(path):
if os.path.exists(top_level_path):
with open(os.path.join(top_level_path), "r", encoding="utf8") as file:
guides_top_level = file.read() + "\n"
gr.Markdown(guides_top_level)
gr.Markdown(guides_top_level)
34 changes: 11 additions & 23 deletions kohya_gui/lora_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

button_run = gr.Button("Start training", variant="primary")

button_stop_training = gr.Button("Stop training")
button_stop_training = gr.Button("Stop training", visible=False)

document_symbol = "\U0001F4C4" # 📄

Expand Down Expand Up @@ -713,14 +713,14 @@ def train_model(
lora_network_weights=lora_network_weights,
dataset_config=dataset_config,
):
return
return TRAIN_BUTTON_VISIBLE

if int(bucket_reso_steps) < 1:
output_message(
msg="Bucket resolution steps need to be greater than 0",
headless=headless,
)
return
return TRAIN_BUTTON_VISIBLE

# if noise_offset == "":
# noise_offset = 0
Expand All @@ -730,7 +730,7 @@ def train_model(
msg="Noise offset need to be a value between 0 and 1",
headless=headless,
)
return
return TRAIN_BUTTON_VISIBLE

if output_dir != "":
if not os.path.exists(output_dir):
Expand All @@ -746,7 +746,7 @@ def train_model(
if not print_only and check_if_model_exist(
output_name, output_dir, save_model_as, headless=headless
):
return
return TRAIN_BUTTON_VISIBLE

# If string is empty set string to 0.
# if text_encoder_lr == "":
Expand Down Expand Up @@ -1015,7 +1015,7 @@ def train_model(
# Sets flags for training specific components based on the provided learning rates.
if float(learning_rate) == unet_lr_float == text_encoder_lr_float == 0:
output_message(msg="Please input learning rate values.", headless=headless)
return
return TRAIN_BUTTON_VISIBLE
# Flag to train text encoder only if its learning rate is non-zero and unet's is zero.
network_train_text_encoder_only = text_encoder_lr_float != 0 and unet_lr_float == 0
# Flag to train unet only if its learning rate is non-zero and text encoder's is zero.
Expand Down Expand Up @@ -2081,25 +2081,13 @@ def update_LoRA_settings(
"Stop training", visible=False, variant="stop"
)

button_print = gr.Button("Print training command")
with gr.Column(), gr.Group():
with gr.Row():
button_print = gr.Button("Print training command")

# Setup gradio tensorboard buttons
with gr.Column(), gr.Group():
(
button_start_tensorboard,
button_stop_tensorboard,
) = gradio_tensorboard()

button_start_tensorboard.click(
start_tensorboard,
inputs=[dummy_headless, folders.logging_dir],
show_progress=False,
)

button_stop_tensorboard.click(
stop_tensorboard,
show_progress=False,
)
TensorboardManager(headless=headless, logging_dir=folders.logging_dir)

settings_list = [
source_model.pretrained_model_name_or_path,
Expand Down Expand Up @@ -2352,4 +2340,4 @@ def update_LoRA_settings(
folders.reg_data_dir,
folders.output_dir,
folders.logging_dir,
)
)
92 changes: 0 additions & 92 deletions kohya_gui/tensorboard_gui.py

This file was deleted.

30 changes: 9 additions & 21 deletions kohya_gui/textual_inversion_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,20 +507,20 @@ def train_model(
vae=vae,
dataset_config=dataset_config,
):
return
return TRAIN_BUTTON_VISIBLE

if token_string == "":
output_message(msg="Token string is missing", headless=headless)
return
return TRAIN_BUTTON_VISIBLE

if init_word == "":
output_message(msg="Init word is missing", headless=headless)
return
return TRAIN_BUTTON_VISIBLE

if not print_only and check_if_model_exist(
output_name, output_dir, save_model_as, headless
):
return
return TRAIN_BUTTON_VISIBLE

if dataset_config:
log.info(
Expand Down Expand Up @@ -1046,25 +1046,13 @@ def list_embedding_files(path):
"Stop training", visible=False, variant="stop"
)

button_print = gr.Button("Print training command")
with gr.Column(), gr.Group():
with gr.Row():
button_print = gr.Button("Print training command")

# Setup gradio tensorboard buttons
with gr.Column(), gr.Group():
(
button_start_tensorboard,
button_stop_tensorboard,
) = gradio_tensorboard()

button_start_tensorboard.click(
start_tensorboard,
inputs=[dummy_headless, folders.logging_dir],
show_progress=False,
)

button_stop_tensorboard.click(
stop_tensorboard,
show_progress=False,
)
TensorboardManager(headless=headless, logging_dir=folders.logging_dir)

settings_list = [
source_model.pretrained_model_name_or_path,
Expand Down Expand Up @@ -1246,4 +1234,4 @@ def list_embedding_files(path):
folders.reg_data_dir,
folders.output_dir,
folders.logging_dir,
)
)
2 changes: 1 addition & 1 deletion requirements_windows.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
bitsandbytes==0.43.0
tensorboard
tensorflow
tensorflow>=2.16.1
onnxruntime-gpu==1.17.1
-r requirements.txt

0 comments on commit 1898851

Please sign in to comment.