Sort json config vars

pull/978/head
bmaltais 2023-06-09 09:23:22 -04:00
parent cdf15c6015
commit 5d03104894
5 changed files with 14 additions and 30 deletions

View File

@ -152,12 +152,8 @@ def save_configuration(
# Return the values of the variables as a dictionary
variables = {
name: value
for name, value in parameters # locals().items()
if name
not in [
'file_path',
'save_as',
]
for name, value in sorted(parameters, key=lambda x: x[0])
if name not in ['file_path', 'save_as']
}
# Extract the destination directory from the file path
@ -517,7 +513,7 @@ def train_model(
run_cmd += f' --train_data_dir="{train_data_dir}"'
if len(reg_data_dir):
run_cmd += f' --reg_data_dir="{reg_data_dir}"'
run_cmd += f' --resolution={max_resolution}'
run_cmd += f' --resolution="{max_resolution}"'
run_cmd += f' --output_dir="{output_dir}"'
if not logging_dir == '':
run_cmd += f' --logging_dir="{logging_dir}"'

View File

@ -151,12 +151,8 @@ def save_configuration(
# Return the values of the variables as a dictionary
variables = {
name: value
for name, value in parameters # locals().items()
if name
not in [
'file_path',
'save_as',
]
for name, value in sorted(parameters, key=lambda x: x[0])
if name not in ['file_path', 'save_as']
}
# Extract the destination directory from the file path
@ -501,7 +497,7 @@ def train_model(
run_cmd += f' --learning_rate={learning_rate}'
run_cmd += ' --enable_bucket'
run_cmd += f' --resolution={max_resolution}'
run_cmd += f' --resolution="{max_resolution}"'
run_cmd += f' --min_bucket_reso={min_bucket_reso}'
run_cmd += f' --max_bucket_reso={max_bucket_reso}'

View File

@ -1002,8 +1002,8 @@ def gradio_advanced_training(headless=False):
bucket_no_upscale = gr.Checkbox(
label="Don't upscale bucket resolution", value=True
)
bucket_reso_steps = gr.Number(
label='Bucket resolution steps', value=64
bucket_reso_steps = gr.Slider(
label='Bucket resolution steps', value=64, minimum=1, maximum=128
)
random_crop = gr.Checkbox(
label='Random crop instead of center crop', value=False

View File

@ -190,12 +190,8 @@ def save_configuration(
# Return the values of the variables as a dictionary
variables = {
name: value
for name, value in parameters # locals().items()
if name
not in [
'file_path',
'save_as',
]
for name, value in sorted(parameters, key=lambda x: x[0])
if name not in ['file_path', 'save_as']
}
# Extract the destination directory from the file path
@ -652,7 +648,7 @@ def train_model(
run_cmd += f' --train_data_dir="{train_data_dir}"'
if len(reg_data_dir):
run_cmd += f' --reg_data_dir="{reg_data_dir}"'
run_cmd += f' --resolution={max_resolution}'
run_cmd += f' --resolution="{max_resolution}"'
run_cmd += f' --output_dir="{output_dir}"'
if not logging_dir == '':
run_cmd += f' --logging_dir="{logging_dir}"'

View File

@ -157,12 +157,8 @@ def save_configuration(
# Return the values of the variables as a dictionary
variables = {
name: value
for name, value in parameters # locals().items()
if name
not in [
'file_path',
'save_as',
]
for name, value in sorted(parameters, key=lambda x: x[0])
if name not in ['file_path', 'save_as']
}
# Extract the destination directory from the file path
@ -530,7 +526,7 @@ def train_model(
run_cmd += f' --train_data_dir="{train_data_dir}"'
if len(reg_data_dir):
run_cmd += f' --reg_data_dir="{reg_data_dir}"'
run_cmd += f' --resolution={max_resolution}'
run_cmd += f' --resolution="{max_resolution}"'
run_cmd += f' --output_dir="{output_dir}"'
if not logging_dir == '':
run_cmd += f' --logging_dir="{logging_dir}"'