From 1d4351ce918c30ac6e492c010e3979b15a2126a4 Mon Sep 17 00:00:00 2001 From: ZeroCool940711 Date: Wed, 7 Sep 2022 16:58:19 -0700 Subject: [PATCH] Added option to set default sampler name from config file, will be useful for those wanting to change the default sampler and have it persist even when closing the UI and opening it again. --- configs/webui/webui_streamlit.yaml | 1 + scripts/webui_streamlit.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/configs/webui/webui_streamlit.yaml b/configs/webui/webui_streamlit.yaml index f102910..84263bd 100644 --- a/configs/webui/webui_streamlit.yaml +++ b/configs/webui/webui_streamlit.yaml @@ -37,6 +37,7 @@ txt2img: batch_count: 1 batch_size: 1 sampling_steps: 50 + default_sampler: "k_lms" separate_prompts: False normalize_prompt_weights: True save_individual_images: True diff --git a/scripts/webui_streamlit.py b/scripts/webui_streamlit.py index 990e9e6..c2714c0 100644 --- a/scripts/webui_streamlit.py +++ b/scripts/webui_streamlit.py @@ -1556,9 +1556,10 @@ def layout(): with col3: st.session_state.sampling_steps = st.slider("Sampling Steps", value=defaults.txt2img.sampling_steps, min_value=1, max_value=250) - sampler_name = st.selectbox("Sampling method", - ["k_lms", "k_euler", "k_euler_a", "k_dpm_2", "k_dpm_2_a", "k_heun", "PLMS", "DDIM"], - index=0, help="Sampling method to use. Default: k_lms") + + sampler_name_list = ["k_lms", "k_euler", "k_euler_a", "k_dpm_2", "k_dpm_2_a", "k_heun", "PLMS", "DDIM"] + sampler_name = st.selectbox("Sampling method", sampler_name_list, + index=sampler_name_list.index(defaults.txt2img.default_sampler), help="Sampling method to use. Default: k_euler")