Add option to print LoRA trainer command without executing it
This commit is contained in:
parent
25d6e252d3
commit
3a5d491ff2
@ -177,7 +177,9 @@ 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.
|
||||
- Add option to print LoRA trainer command without executing it
|
||||
- Add support for samples during trainin via a new `Sample images config` accordion in the `Training parameters` tab.
|
||||
- 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.
|
||||
|
38
lora_gui.py
38
lora_gui.py
@ -269,6 +269,7 @@ def open_configuration(
|
||||
|
||||
|
||||
def train_model(
|
||||
print_only,
|
||||
pretrained_model_name_or_path,
|
||||
v2,
|
||||
v_parameterization,
|
||||
@ -337,6 +338,8 @@ def train_model(
|
||||
sample_sampler,
|
||||
sample_prompts,additional_parameters,
|
||||
):
|
||||
print_only_bool = True if print_only.get('label') == 'True' else False
|
||||
|
||||
if pretrained_model_name_or_path == '':
|
||||
msgbox('Source model information is missing')
|
||||
return
|
||||
@ -571,20 +574,23 @@ def train_model(
|
||||
output_dir,
|
||||
)
|
||||
|
||||
print(run_cmd)
|
||||
|
||||
# Run the command
|
||||
if os.name == 'posix':
|
||||
os.system(run_cmd)
|
||||
if print_only_bool:
|
||||
print('Here is the trainer command as a reference. It will not be executed:')
|
||||
print(run_cmd)
|
||||
else:
|
||||
subprocess.run(run_cmd)
|
||||
print(run_cmd)
|
||||
# Run the command
|
||||
if os.name == 'posix':
|
||||
os.system(run_cmd)
|
||||
else:
|
||||
subprocess.run(run_cmd)
|
||||
|
||||
# check if output_dir/last is a folder... therefore it is a diffuser model
|
||||
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
||||
# check if output_dir/last is a folder... therefore it is a diffuser model
|
||||
last_dir = pathlib.Path(f'{output_dir}/{output_name}')
|
||||
|
||||
if not last_dir.is_dir():
|
||||
# Copy inference model for v2 if required
|
||||
save_inference_file(output_dir, v2, v_parameterization, output_name)
|
||||
if not last_dir.is_dir():
|
||||
# Copy inference model for v2 if required
|
||||
save_inference_file(output_dir, v2, v_parameterization, output_name)
|
||||
|
||||
|
||||
def lora_tab(
|
||||
@ -877,6 +883,8 @@ def lora_tab(
|
||||
gradio_verify_lora_tab()
|
||||
|
||||
button_run = gr.Button('Train model', variant='primary')
|
||||
|
||||
button_print = gr.Button('Print training command')
|
||||
|
||||
# Setup gradio tensorboard buttons
|
||||
button_start_tensorboard, button_stop_tensorboard = gradio_tensorboard()
|
||||
@ -985,7 +993,13 @@ def lora_tab(
|
||||
|
||||
button_run.click(
|
||||
train_model,
|
||||
inputs=settings_list,
|
||||
inputs=[dummy_db_false] + settings_list,
|
||||
show_progress=False,
|
||||
)
|
||||
|
||||
button_print.click(
|
||||
train_model,
|
||||
inputs=[dummy_db_true] + settings_list,
|
||||
show_progress=False,
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user