From ab2ff579d60b9a1c58839a67dbc0ea6586abce19 Mon Sep 17 00:00:00 2001 From: Zyin055 <5003647+Zyin055@users.noreply.github.com> Date: Mon, 5 Feb 2024 11:41:13 -0600 Subject: [PATCH] fix for "Use same sampler" sampler dropdown value The hr_sampler component dropdown has a value called "Use same sampler" which needed a special case for in order to not error. #75 --- scripts/config_presets.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/config_presets.py b/scripts/config_presets.py index 5776ee2..e4435fa 100644 --- a/scripts/config_presets.py +++ b/scripts/config_presets.py @@ -1209,8 +1209,11 @@ def save_config(config_presets, component_map, config_file_name): new_value = new_setting[i] # this gives the index when the component is a dropdown if isinstance(new_value, str) and (component_id == "txt2img_sampling" or component_id == "img2img_sampling" or component_id == "hr_sampler"): - if isinstance(new_value, str): #in A1111 1.6.0(?) the sampler is now returned as a string instead of an integer - new_setting_map[component_id] = modules.sd_samplers.samplers_map[new_value.lower()] + if isinstance(new_value, str): # in A1111 1.6.0(?) the sampler is now returned as a string instead of an integer + if new_value == "Use same sampler": # the hr_sampler dropdown has a "Use same sampler" value that doesn't exist in the samplers_map + new_setting_map[component_id] = new_value + else: + new_setting_map[component_id] = modules.sd_samplers.samplers_map[new_value.lower()] elif isinstance(new_value, int): new_setting_map[component_id] = modules.sd_samplers.samplers[new_value].name else: