Fixed multiple settings and default values not working properly.

This commit is contained in:
ZeroCool940711 2022-10-02 21:25:41 -07:00
parent 393a695aef
commit f866ffdad4
4 changed files with 39 additions and 34 deletions

View File

@ -29,11 +29,11 @@ general:
default_model_path: "models/ldm/stable-diffusion-v1/model.ckpt" default_model_path: "models/ldm/stable-diffusion-v1/model.ckpt"
use_sd_concepts_library: True use_sd_concepts_library: True
sd_concepts_library_folder: "models/custom/sd-concepts-library" sd_concepts_library_folder: "models/custom/sd-concepts-library"
GFPGAN_dir: "./src/gfpgan" GFPGAN_dir: "./models/gfpgan"
GFPGAN_model: "GFPGANv1.4" GFPGAN_model: "GFPGANv1.4"
LDSR_dir: "./models/ldsr" LDSR_dir: "./models/ldsr"
LDSR_model: "model" LDSR_model: "model"
RealESRGAN_dir: "./src/realesrgan" RealESRGAN_dir: "./models/realesrgan"
RealESRGAN_model: "RealESRGAN_x4plus" RealESRGAN_model: "RealESRGAN_x4plus"
upscaling_method: "RealESRGAN" upscaling_method: "RealESRGAN"
outdir_txt2img: outputs/txt2img outdir_txt2img: outputs/txt2img
@ -91,6 +91,9 @@ txt2img:
sampling_steps: sampling_steps:
value: 30 value: 30
min_value: 10
max_value: 250
step: 10
LDSR_config: LDSR_config:
sampling_steps: 50 sampling_steps: 50

View File

@ -282,14 +282,14 @@ def layout():
st.title("General Parameters") st.title("General Parameters")
# Batch Count # Batch Count
st.session_state["batch_count"] = st.text_input("Batch count.", value=st.session_state['defaults'].txt2img.batch_count.value, st.session_state["defaults"].txt2img.batch_count.value = int(st.text_input("Batch count", value=st.session_state['defaults'].txt2img.batch_count.value,
help="How many iterations or batches of images to generate in total.") help="How many iterations or batches of images to generate in total."))
st.session_state["batch_size"] = st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, st.session_state["defaults"].txt2img.batch_size.value = int(st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value,
help="How many images are at once in a batch.\ help="How many images are at once in a batch.\
It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it \ It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it \
takes to finish generation as more images are generated at once.\ takes to finish generation as more images are generated at once.\
Default: 1") Default: 1"))
default_sampler_list = ["k_lms", "k_euler", "k_euler_a", "k_dpm_2", "k_dpm_2_a", "k_heun", "PLMS", "DDIM"] default_sampler_list = ["k_lms", "k_euler", "k_euler_a", "k_dpm_2", "k_dpm_2_a", "k_heun", "PLMS", "DDIM"]
st.session_state["defaults"].txt2img.default_sampler = st.selectbox("Default Sampler", st.session_state["defaults"].txt2img.default_sampler = st.selectbox("Default Sampler",
@ -446,14 +446,14 @@ def layout():
help="Set the default value for the number of steps on the sampling steps slider. Default is: 10")) help="Set the default value for the number of steps on the sampling steps slider. Default is: 10"))
# Batch Count # Batch Count
st.session_state["batch_count"] = st.text_input("Batch count.", value=st.session_state['defaults'].txt2img.batch_count.value, st.session_state["defaults"].img2img.batch_count.value = int(st.text_input("Img2img Batch count", value=st.session_state["defaults"].img2img.batch_count.value,
help="How many iterations or batches of images to generate in total.") help="How many iterations or batches of images to generate in total."))
st.session_state["batch_size"] = st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, st.session_state["defaults"].img2img.batch_size.value = int(st.text_input("Img2img Batch size", value=st.session_state["defaults"].img2img.batch_size.value,
help="How many images are at once in a batch.\ help="How many images are at once in a batch.\
It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it \ It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it \
takes to finish generation as more images are generated at once.\ takes to finish generation as more images are generated at once.\
Default: 1") Default: 1"))
with col4: with col4:
# Inference Steps # Inference Steps
st.session_state["defaults"].img2img.num_inference_steps.value = int(st.text_input("Default Inference Steps", st.session_state["defaults"].img2img.num_inference_steps.value = int(st.text_input("Default Inference Steps",
@ -635,14 +635,14 @@ def layout():
help="Set the default value for the number of steps on the sampling steps slider. Default is: 10")) help="Set the default value for the number of steps on the sampling steps slider. Default is: 10"))
# Batch Count # Batch Count
st.session_state["batch_count"] = st.text_input("Batch count.", value=st.session_state['defaults'].txt2img.batch_count.value, st.session_state["defaults"].txt2vid.batch_count.value = int(st.text_input("txt2vid Batch count", value=st.session_state['defaults'].txt2vid.batch_count.value,
help="How many iterations or batches of images to generate in total.") help="How many iterations or batches of images to generate in total."))
st.session_state["batch_size"] = st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, st.session_state["defaults"].txt2vid.batch_size.value = int(st.text_input("txt2vid Batch size", value=st.session_state.defaults.txt2vid.batch_size.value,
help="How many images are at once in a batch.\ help="How many images are at once in a batch.\
It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it \ It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it \
takes to finish generation as more images are generated at once.\ takes to finish generation as more images are generated at once.\
Default: 1") Default: 1") )
# Inference Steps # Inference Steps
st.session_state["defaults"].txt2vid.num_inference_steps.value = int(st.text_input("Default Txt2Vid Inference Steps", st.session_state["defaults"].txt2vid.num_inference_steps.value = int(st.text_input("Default Txt2Vid Inference Steps",

View File

@ -215,7 +215,8 @@ def layout():
st.session_state["batch_size"] = int(st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, st.session_state["batch_size"] = int(st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value,
help="How many images are at once in a batch.\ help="How many images are at once in a batch.\
It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it takes to finish generation as more images are generated at once.\ It increases the VRAM usage a lot but if you have enough VRAM it can reduce the time it takes \
to finish generation as more images are generated at once.\
Default: 1") ) Default: 1") )
with st.expander("Preview Settings"): with st.expander("Preview Settings"):
@ -336,8 +337,9 @@ def layout():
if st.session_state["LDSR_available"]: if st.session_state["LDSR_available"]:
upscaling_method_list.append("LDSR") upscaling_method_list.append("LDSR")
#print (st.session_state["RealESRGAN_available"])
st.session_state["upscaling_method"] = st.selectbox("Upscaling Method", upscaling_method_list, st.session_state["upscaling_method"] = st.selectbox("Upscaling Method", upscaling_method_list,
index=upscaling_method_list.index(st.session_state['defaults'].general.upscaling_method)) index=upscaling_method_list.index(str(st.session_state['defaults'].general.upscaling_method)))
if st.session_state["RealESRGAN_available"]: if st.session_state["RealESRGAN_available"]:
with st.expander("RealESRGAN"): with st.expander("RealESRGAN"):