diff --git a/modules/extras.py b/modules/extras.py index f6704382a..b8ebc6193 100644 --- a/modules/extras.py +++ b/modules/extras.py @@ -186,9 +186,9 @@ def run_modelmerger(primary_model_name, secondary_model_name, interp_method, int if 'model' in key and key not in theta_0: theta_0[key] = theta_1[key] - output_modelname = 'models/' + primary_model_name + '_' + str(interp_amount) + '-' + secondary_model_name + '_' + str(float(1.0) - interp_amount) + '-' + interp_method.replace(" ", "_") + '-merged.ckpt' + output_modelname = 'models/' + primary_model_name + '_' + str(round(interp_amount,2)) + '-' + secondary_model_name + '_' + str(round((float(1.0) - interp_amount),2)) + '-' + interp_method.replace(" ", "_") + '-merged.ckpt' print(f"Saving to {output_modelname}...") torch.save(primary_model, output_modelname) print(f"Checkpoint saved.") - return "Checkpoint saved to " + output_modelname + return "Checkpoint saved to " + output_modelname \ No newline at end of file diff --git a/modules/ui.py b/modules/ui.py index 4a5326f74..7db8edbd8 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -860,7 +860,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger): gr.HTML(value="
A merger of the two checkpoints will be generated in your /models directory.
") with gr.Row(): - ckpt_name_list = [x.model_name for x in modules.sd_models.checkpoints_list.values()] + ckpt_name_list = sorted([x.model_name for x in modules.sd_models.checkpoints_list.values()]) primary_model_name = gr.Dropdown(ckpt_name_list, elem_id="modelmerger_primary_model_name", label="Primary Model Name") secondary_model_name = gr.Dropdown(ckpt_name_list, elem_id="modelmerger_secondary_model_name", label="Secondary Model Name") interp_amount = gr.Slider(minimum=0.0, maximum=1.0, step=0.05, label='Interpolation Amount', value=0.3)