Undo LoCon commit

This commit is contained in:
bmaltais 2023-02-28 07:37:19 -05:00
parent 04f0f0cf4f
commit dfd155a8e1

View File

@ -10,7 +10,6 @@ import os
import subprocess
import pathlib
import argparse
import shutil
from library.common_gui import (
get_folder_path,
remove_doublequote,
@ -44,12 +43,6 @@ folder_symbol = '\U0001f4c2' # 📂
refresh_symbol = '\U0001f504' # 🔄
save_style_symbol = '\U0001f4be' # 💾
document_symbol = '\U0001F4C4' # 📄
locon_path = os.getcwd()+'\\locon\\'
def getlocon():
os.system('git clone https://github.com/KohakuBlueleaf/LoCon.git')
os.system('ren '+locon_path[:-6]+'\\LoCon\\'+' locon_github-sourcecode')
shutil.copytree(locon_path[:-6]+'locon_github-sourcecode\\locon\\', locon_path)
def save_configuration(
save_as,
@ -111,7 +104,7 @@ def save_configuration(
bucket_reso_steps,
caption_dropout_every_n_epochs, caption_dropout_rate,
optimizer,
optimizer_args,noise_offset, locon = 0
optimizer_args,noise_offset,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -217,7 +210,7 @@ def open_configuration(
bucket_reso_steps,
caption_dropout_every_n_epochs, caption_dropout_rate,
optimizer,
optimizer_args,noise_offset, locon=0
optimizer_args,noise_offset,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -301,7 +294,7 @@ def train_model(
bucket_reso_steps,
caption_dropout_every_n_epochs, caption_dropout_rate,
optimizer,
optimizer_args,noise_offset, locon
optimizer_args,noise_offset,
):
if pretrained_model_name_or_path == '':
msgbox('Source model information is missing')
@ -437,12 +430,7 @@ def train_model(
run_cmd += f' --save_model_as={save_model_as}'
if not float(prior_loss_weight) == 1.0:
run_cmd += f' --prior_loss_weight={prior_loss_weight}'
if locon:
if not os.path.exists(locon_path):
getlocon()
run_cmd += ' --network_module=locon.locon_kohya'
else:
run_cmd += f' --network_module=networks.lora'
run_cmd += f' --network_module=networks.lora'
if not (float(text_encoder_lr) == 0) or not (float(unet_lr) == 0):
if not (float(text_encoder_lr) == 0) and not (float(unet_lr) == 0):
@ -690,8 +678,6 @@ def lora_tab(
)
enable_bucket = gr.Checkbox(label='Enable buckets', value=True)
with gr.Accordion('Advanced Configuration', open=False):
with gr.Row():
locon= gr.Checkbox(label='Train a LoCon instead of a general LoRA (may not be able to merge now)', value=False)
with gr.Row():
no_token_padding = gr.Checkbox(
label='No token padding', value=False
@ -833,7 +819,7 @@ def lora_tab(
bucket_reso_steps,
caption_dropout_every_n_epochs, caption_dropout_rate,
optimizer,
optimizer_args,noise_offset,locon
optimizer_args,noise_offset,
]
button_open_config.click(
@ -922,4 +908,4 @@ if __name__ == '__main__':
args = parser.parse_args()
UI(username=args.username, password=args.password, inbrowser=args.inbrowser, server_port=args.server_port)
UI(username=args.username, password=args.password, inbrowser=args.inbrowser, server_port=args.server_port)