Add additional parameters feild

This commit is contained in:
bmaltais 2023-03-07 07:42:13 -05:00
parent 3fe01f70bc
commit 7ed8f7c3c5
7 changed files with 33 additions and 18 deletions

View File

@ -177,6 +177,7 @@ This will store your a backup file with your current locally installed pip packa
## Change History
* 2023/03/05 (v21.2.0):
- Added new `Additional parameters` under the `Advanced Configuration` section of the `Training parameters` tab.to allow for the specifications of parameters not handles by the GUI.
- Added support for sample as a new Accordion under the `Training parameters` tab. More info about the prompt options can be found here: https://github.com/kohya-ss/sd-scripts/issues/256#issuecomment-1455005709
- There may be problems due to major changes. If you cannot revert back to a previous version when problems occur (`git checkout <release name>`).
- Dependencies are updated, Please [upgrade](#upgrade) the repo.

View File

@ -104,7 +104,7 @@ def save_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -209,7 +209,7 @@ def open_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -293,7 +293,7 @@ def train_model(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
if pretrained_model_name_or_path == '':
msgbox('Source model information is missing')
@ -465,6 +465,7 @@ def train_model(
caption_dropout_every_n_epochs=caption_dropout_every_n_epochs,
caption_dropout_rate=caption_dropout_rate,
noise_offset=noise_offset,
additional_parameters=additional_parameters,
)
run_cmd += run_cmd_sample(
@ -668,6 +669,7 @@ def dreambooth_tab(
caption_dropout_every_n_epochs,
caption_dropout_rate,
noise_offset,
additional_parameters,
) = gradio_advanced_training()
color_aug.change(
color_aug_changed,
@ -767,6 +769,7 @@ def dreambooth_tab(
sample_every_n_epochs,
sample_sampler,
sample_prompts,
additional_parameters,
]
button_open_config.click(

View File

@ -102,7 +102,7 @@ def save_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -213,7 +213,7 @@ def open_config_file(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -303,7 +303,7 @@ def train_model(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# create caption json file
if generate_caption_database:
@ -457,6 +457,7 @@ def train_model(
caption_dropout_every_n_epochs=caption_dropout_every_n_epochs,
caption_dropout_rate=caption_dropout_rate,
noise_offset=noise_offset,
additional_parameters=additional_parameters,
)
run_cmd += run_cmd_sample(
@ -669,7 +670,7 @@ def finetune_tab():
bucket_reso_steps,
caption_dropout_every_n_epochs,
caption_dropout_rate,
noise_offset,
noise_offset,additional_parameters,
) = gradio_advanced_training()
color_aug.change(
color_aug_changed,
@ -762,7 +763,7 @@ def finetune_tab():
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
]
button_run.click(train_model, inputs=settings_list)

View File

@ -659,6 +659,11 @@ def run_cmd_training(**kwargs):
def gradio_advanced_training():
with gr.Row():
additional_parameters = gr.Textbox(
label='Additional parameters',
placeholder='(Optional) Use to provide additional parameters not handled by the GUI. Eg: --some_parameters "value"',
)
with gr.Row():
keep_tokens = gr.Slider(
label='Keep n tokens', value='0', minimum=0, maximum=32, step=1
@ -761,6 +766,7 @@ def gradio_advanced_training():
caption_dropout_every_n_epochs,
caption_dropout_rate,
noise_offset,
additional_parameters,
)
@ -812,6 +818,7 @@ def run_cmd_advanced_training(**kwargs):
f' --noise_offset={float(kwargs.get("noise_offset", 0))}'
if not kwargs.get('noise_offset', '') == ''
else '',
f' {kwargs.get("additional_parameters", "")}'
]
run_cmd = ''.join(options)
return run_cmd

View File

@ -56,6 +56,7 @@ def sample_gradio_config():
lines=5,
label='Sample prompts',
interactive=True,
placeholder='masterpiece, best quality, 1girl, in white shirts, upper body, looking at viewer, simple background --n low quality, worst quality, bad anatomy,bad composition, poor, low effort --w 768 --h 768 --d 1 --l 7.5 --s 28',
)
return (
sample_every_n_steps,

View File

@ -119,7 +119,7 @@ def save_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -234,7 +234,7 @@ def open_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -335,7 +335,7 @@ def train_model(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
if pretrained_model_name_or_path == '':
msgbox('Source model information is missing')
@ -555,6 +555,7 @@ def train_model(
caption_dropout_every_n_epochs=caption_dropout_every_n_epochs,
caption_dropout_rate=caption_dropout_rate,
noise_offset=noise_offset,
additional_parameters=additional_parameters,
)
run_cmd += run_cmd_sample(
@ -838,7 +839,7 @@ def lora_tab(
bucket_reso_steps,
caption_dropout_every_n_epochs,
caption_dropout_rate,
noise_offset,
noise_offset,additional_parameters,
) = gradio_advanced_training()
color_aug.change(
color_aug_changed,
@ -951,7 +952,7 @@ def lora_tab(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
]
button_open_config.click(

View File

@ -110,7 +110,7 @@ def save_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -221,7 +221,7 @@ def open_configuration(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
# Get list of function parameters and values
parameters = list(locals().items())
@ -311,7 +311,7 @@ def train_model(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
):
if pretrained_model_name_or_path == '':
msgbox('Source model information is missing')
@ -498,6 +498,7 @@ def train_model(
caption_dropout_every_n_epochs=caption_dropout_every_n_epochs,
caption_dropout_rate=caption_dropout_rate,
noise_offset=noise_offset,
additional_parameters=additional_parameters,
)
run_cmd += f' --token_string="{token_string}"'
run_cmd += f' --init_word="{init_word}"'
@ -753,7 +754,7 @@ def ti_tab(
bucket_reso_steps,
caption_dropout_every_n_epochs,
caption_dropout_rate,
noise_offset,
noise_offset,additional_parameters,
) = gradio_advanced_training()
color_aug.change(
color_aug_changed,
@ -858,7 +859,7 @@ def ti_tab(
sample_every_n_steps,
sample_every_n_epochs,
sample_sampler,
sample_prompts,
sample_prompts,additional_parameters,
]
button_open_config.click(