From f866ffdad46ba4cf5f85fa60f10b1ff3fefb5f7a Mon Sep 17 00:00:00 2001 From: ZeroCool940711 Date: Sun, 2 Oct 2022 21:25:41 -0700 Subject: [PATCH] Fixed multiple settings and default values not working properly. --- configs/webui/webui_streamlit.yaml | 7 +++-- scripts/Settings.py | 42 +++++++++++++++--------------- scripts/txt2img.py | 10 ++++--- scripts/txt2vid.py | 14 +++++----- 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/configs/webui/webui_streamlit.yaml b/configs/webui/webui_streamlit.yaml index 6325c9b..3ae6bfc 100644 --- a/configs/webui/webui_streamlit.yaml +++ b/configs/webui/webui_streamlit.yaml @@ -29,11 +29,11 @@ general: default_model_path: "models/ldm/stable-diffusion-v1/model.ckpt" use_sd_concepts_library: True sd_concepts_library_folder: "models/custom/sd-concepts-library" - GFPGAN_dir: "./src/gfpgan" + GFPGAN_dir: "./models/gfpgan" GFPGAN_model: "GFPGANv1.4" LDSR_dir: "./models/ldsr" LDSR_model: "model" - RealESRGAN_dir: "./src/realesrgan" + RealESRGAN_dir: "./models/realesrgan" RealESRGAN_model: "RealESRGAN_x4plus" upscaling_method: "RealESRGAN" outdir_txt2img: outputs/txt2img @@ -91,6 +91,9 @@ txt2img: sampling_steps: value: 30 + min_value: 10 + max_value: 250 + step: 10 LDSR_config: sampling_steps: 50 diff --git a/scripts/Settings.py b/scripts/Settings.py index 8a30186..dcc7e07 100644 --- a/scripts/Settings.py +++ b/scripts/Settings.py @@ -282,14 +282,14 @@ def layout(): st.title("General Parameters") # Batch Count - st.session_state["batch_count"] = 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.") + 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.")) - st.session_state["batch_size"] = st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, - 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.\ - Default: 1") + 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.\ + 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_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", @@ -446,14 +446,14 @@ def layout(): help="Set the default value for the number of steps on the sampling steps slider. Default is: 10")) # Batch Count - st.session_state["batch_count"] = 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.") + 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.")) - st.session_state["batch_size"] = st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, - 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.\ - Default: 1") + 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.\ + 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")) with col4: # 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")) # Batch Count - st.session_state["batch_count"] = 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.") + 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.")) - st.session_state["batch_size"] = st.text_input("Batch size", value=st.session_state.defaults.txt2img.batch_size.value, - 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.\ - Default: 1") + 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.\ + 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") ) # Inference Steps st.session_state["defaults"].txt2vid.num_inference_steps.value = int(st.text_input("Default Txt2Vid Inference Steps", diff --git a/scripts/txt2img.py b/scripts/txt2img.py index 4b997f9..7192747 100644 --- a/scripts/txt2img.py +++ b/scripts/txt2img.py @@ -214,9 +214,10 @@ def layout(): help="How many iterations or batches of images to generate in total.")) 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.\ - 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") ) + 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.\ + Default: 1") ) with st.expander("Preview Settings"): @@ -336,8 +337,9 @@ def layout(): if st.session_state["LDSR_available"]: upscaling_method_list.append("LDSR") + #print (st.session_state["RealESRGAN_available"]) 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"]: with st.expander("RealESRGAN"): diff --git a/scripts/txt2vid.py b/scripts/txt2vid.py index 16a76ff..0576cbe 100644 --- a/scripts/txt2vid.py +++ b/scripts/txt2vid.py @@ -867,13 +867,13 @@ def layout(): # run video generation video, seed, info, stats = txt2vid(prompts=prompt, gpu=st.session_state["defaults"].general.gpu, num_steps=st.session_state.sampling_steps, max_frames=int(st.session_state.max_frames), - num_inference_steps=st.session_state.num_inference_steps, - cfg_scale=cfg_scale,do_loop=st.session_state["do_loop"], - seeds=seed, quality=100, eta=0.0, width=width, - height=height, weights_path=custom_model, scheduler=scheduler_name, - disable_tqdm=False, beta_start=st.session_state['defaults'].txt2vid.beta_start.value, - beta_end=st.session_state['defaults'].txt2vid.beta_end.value, - beta_schedule=beta_scheduler_type, starting_image=None) + num_inference_steps=st.session_state.num_inference_steps, + cfg_scale=cfg_scale,do_loop=st.session_state["do_loop"], + seeds=seed, quality=100, eta=0.0, width=width, + height=height, weights_path=custom_model, scheduler=scheduler_name, + disable_tqdm=False, beta_start=st.session_state['defaults'].txt2vid.beta_start.value, + beta_end=st.session_state['defaults'].txt2vid.beta_end.value, + beta_schedule=beta_scheduler_type, starting_image=None) #message.success('Done!', icon="✅") message.success('Render Complete: ' + info + '; Stats: ' + stats, icon="✅")