diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py index eeaa66d9d..90c00bde4 100644 --- a/modules/sd_samplers.py +++ b/modules/sd_samplers.py @@ -32,7 +32,11 @@ def set_samplers(): global samplers, samplers_for_img2img shown_img2img = set(shared.opts.show_samplers) - shown = set(shared.opts.show_samplers + ['PLMS', 'UniPC']) + + if len(shared.opts.show_samplers) == 0: + shown = {'PLMS', 'UniPC'} + else: + shown = set(shared.opts.show_samplers + ['PLMS']) samplers = [x for x in all_samplers if x.name in shown] samplers_for_img2img = [x for x in all_samplers if x.name in shown_img2img] diff --git a/modules/shared.py b/modules/shared.py index 118dc8f4f..66e56a267 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -424,7 +424,7 @@ options_templates.update(options_section(('ui', "Live previews"), { })) options_templates.update(options_section(('sampler-params', "Sampler parameters"), { - "show_samplers": OptionInfo(["Euler a", "UniPC", "DDIM", "DPM++ SDE", "DPM++ SDE", "DPM2 Karras", "DPM++ 2M Karras"], "Show samplers in user interface", gr.CheckboxGroup, lambda: {"choices": [x.name for x in list_samplers()]}), + "show_samplers": OptionInfo(["Euler a", "UniPC", "DDIM", "DPM++ SDE", "DPM++ SDE", "DPM2 Karras", "DPM++ 2M Karras"], "Show samplers in user interface", gr.CheckboxGroup, lambda: {"choices": [x.name for x in list_samplers() if x.name != "PLMS"]}), "fallback_sampler": OptionInfo("Euler a", "Secondary sampler", gr.Dropdown, lambda: {"choices": ["None"] + [x.name for x in list_samplers()]}), "eta_ancestral": OptionInfo(1.0, "Noise multiplier for ancestral samplers (eta)", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}), "eta_ddim": OptionInfo(0.0, "Noise multiplier for DDIM (eta)", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}), diff --git a/modules/ui.py b/modules/ui.py index 77761269b..9d26faf87 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -303,7 +303,14 @@ def create_output_panel(tabname, outdir): def create_sampler_and_steps_selection(choices, tabname): with FormRow(elem_id=f"sampler_selection_{tabname}"): - sampler_index = gr.Dropdown(label='Sampling method', elem_id=f"{tabname}_sampling", choices=[x.name for x in choices], value="UniPC" if tabname == 'txt2img' else "Euler a", type="index") + if 'UniPC' in [sampler.name for sampler in choices]: + chosen_sampler_name = 'UniPC' + elif 'Euler a' in [sampler.name for sampler in choices]: + chosen_sampler_name = 'Euler a' + else: + chosen_sampler_name = samplers[0].name + + sampler_index = gr.Dropdown(label='Sampling method', elem_id=f"{tabname}_sampling", choices=[x.name for x in choices], value=chosen_sampler_name if tabname == 'txt2img' else "Euler a", type="index") steps = gr.Slider(minimum=1, maximum=150, step=1, elem_id=f"{tabname}_steps", label="Sampling steps", value=20) return steps, sampler_index