Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed multiple settings and default values not working properly. #1403

Merged
merged 2 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions configs/webui/webui_streamlit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -91,6 +91,9 @@ txt2img:

sampling_steps:
value: 30
min_value: 10
max_value: 250
step: 10

LDSR_config:
sampling_steps: 50
Expand Down
44 changes: 22 additions & 22 deletions scripts/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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["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_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["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",
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 6 additions & 4 deletions scripts/txt2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):

Expand Down Expand Up @@ -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"):
Expand Down
14 changes: 7 additions & 7 deletions scripts/txt2vid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="✅")
Expand Down