Add option to select between lerp and slerp in txt2vid

This commit is contained in:
ZeroCool940711 2022-10-11 01:27:44 -07:00 committed by Alejandro Gil
parent 2215a3b403
commit 1cc22b0984
2 changed files with 43 additions and 42 deletions

View File

@ -21,7 +21,7 @@
general: general:
streamlit_telemetry: False streamlit_telemetry: False
default_theme: dark default_theme: dark
huggingface_token: "" huggingface_token: ''
gpu: 0 gpu: 0
outdir: outputs outdir: outputs
default_model: "Stable Diffusion v1.4" default_model: "Stable Diffusion v1.4"
@ -179,6 +179,7 @@ txt2vid:
group_by_prompt: True group_by_prompt: True
write_info_files: True write_info_files: True
do_loop: False do_loop: False
use_lerp_for_text: False
save_as_jpg: False save_as_jpg: False
use_GFPGAN: False use_GFPGAN: False
use_RealESRGAN: False use_RealESRGAN: False
@ -194,16 +195,16 @@ txt2vid:
beta_start: beta_start:
value: 0.00085 value: 0.00085
min_value: 0.0001 min_value: 0.00010
max_value: 0.0300 max_value: 0.03000
step: 0.0001 step: 0.00010
format: "%.5f" format: "%.5f"
beta_end: beta_end:
value: 0.012 value: 0.01200
min_value: 0.0001 min_value: 0.00010
max_value: 0.0300 max_value: 0.03000
step: 0.0001 step: 0.00010
format: "%.5f" format: "%.5f"
beta_scheduler_type: "scaled_linear" beta_scheduler_type: "scaled_linear"

View File

@ -12,14 +12,14 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# base webui import and utils. # base webui import and utils.
#import streamlit as st #import streamlit as st
# We import hydralit like this to replace the previous stuff # We import hydralit like this to replace the previous stuff
# we had with native streamlit as it lets ur replace things 1:1 # we had with native streamlit as it lets ur replace things 1:1
#import hydralit as st #import hydralit as st
from sd_utils import * from sd_utils import *
# streamlit imports # streamlit imports
@ -38,7 +38,7 @@ from omegaconf import OmegaConf
if not "defaults" in st.session_state: if not "defaults" in st.session_state:
st.session_state["defaults"] = {} st.session_state["defaults"] = {}
st.session_state["defaults"] = OmegaConf.load("configs/webui/webui_streamlit.yaml") st.session_state["defaults"] = OmegaConf.load("configs/webui/webui_streamlit.yaml")
if (os.path.exists("configs/webui/userconfig_streamlit.yaml")): if (os.path.exists("configs/webui/userconfig_streamlit.yaml")):
@ -47,7 +47,7 @@ if (os.path.exists("configs/webui/userconfig_streamlit.yaml")):
else: else:
OmegaConf.save(config=st.session_state.defaults, f="configs/webui/userconfig_streamlit.yaml") OmegaConf.save(config=st.session_state.defaults, f="configs/webui/userconfig_streamlit.yaml")
loaded = OmegaConf.load("configs/webui/userconfig_streamlit.yaml") loaded = OmegaConf.load("configs/webui/userconfig_streamlit.yaml")
assert st.session_state.defaults == loaded assert st.session_state.defaults == loaded
if (os.path.exists(".streamlit/config.toml")): if (os.path.exists(".streamlit/config.toml")):
st.session_state["streamlit_config"] = toml.load(".streamlit/config.toml") st.session_state["streamlit_config"] = toml.load(".streamlit/config.toml")
@ -66,7 +66,7 @@ except:
# remove some annoying deprecation warnings that show every now and then. # remove some annoying deprecation warnings that show every now and then.
warnings.filterwarnings("ignore", category=DeprecationWarning) warnings.filterwarnings("ignore", category=DeprecationWarning)
warnings.filterwarnings("ignore", category=UserWarning) warnings.filterwarnings("ignore", category=UserWarning)
# this should force GFPGAN and RealESRGAN onto the selected gpu as well # this should force GFPGAN and RealESRGAN onto the selected gpu as well
#os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152 #os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" # see issue #152
@ -74,7 +74,7 @@ warnings.filterwarnings("ignore", category=UserWarning)
# functions to load css locally OR remotely starts here. Options exist for future flexibility. Called as st.markdown with unsafe_allow_html as css injection # functions to load css locally OR remotely starts here. Options exist for future flexibility. Called as st.markdown with unsafe_allow_html as css injection
# TODO, maybe look into async loading the file especially for remote fetching # TODO, maybe look into async loading the file especially for remote fetching
def local_css(file_name): def local_css(file_name):
with open(file_name) as f: with open(file_name) as f:
st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True) st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
@ -97,7 +97,7 @@ def layout():
with st.empty(): with st.empty():
# load css as an external file, function has an option to local or remote url. Potential use when running from cloud infra that might not have access to local path. # load css as an external file, function has an option to local or remote url. Potential use when running from cloud infra that might not have access to local path.
load_css(True, 'frontend/css/streamlit.main.css') load_css(True, 'frontend/css/streamlit.main.css')
# check if the models exist on their respective folders # check if the models exist on their respective folders
with server_state_lock["GFPGAN_available"]: with server_state_lock["GFPGAN_available"]:
if os.path.exists(os.path.join(st.session_state["defaults"].general.GFPGAN_dir, f"{st.session_state['defaults'].general.GFPGAN_model}.pth")): if os.path.exists(os.path.join(st.session_state["defaults"].general.GFPGAN_dir, f"{st.session_state['defaults'].general.GFPGAN_model}.pth")):
@ -107,20 +107,20 @@ def layout():
with server_state_lock["RealESRGAN_available"]: with server_state_lock["RealESRGAN_available"]:
if os.path.exists(os.path.join(st.session_state["defaults"].general.RealESRGAN_dir, f"{st.session_state['defaults'].general.RealESRGAN_model}.pth")): if os.path.exists(os.path.join(st.session_state["defaults"].general.RealESRGAN_dir, f"{st.session_state['defaults'].general.RealESRGAN_model}.pth")):
server_state["RealESRGAN_available"] = True server_state["RealESRGAN_available"] = True
else: else:
server_state["RealESRGAN_available"] = False server_state["RealESRGAN_available"] = False
with st.sidebar: with st.sidebar:
tabs = on_hover_tabs(tabName=['Stable Diffusion', "Textual Inversion","Model Manager","Settings"], tabs = on_hover_tabs(tabName=['Stable Diffusion', "Textual Inversion","Model Manager","Settings"],
iconName=['dashboard','model_training' ,'cloud_download', 'settings'], default_choice=0) iconName=['dashboard','model_training' ,'cloud_download', 'settings'], default_choice=0)
# need to see how to get the icons to show for the hydralit option_bar # need to see how to get the icons to show for the hydralit option_bar
#tabs = hc.option_bar([{'icon':'grid-outline','label':'Stable Diffusion'}, {'label':"Textual Inversion"}, #tabs = hc.option_bar([{'icon':'grid-outline','label':'Stable Diffusion'}, {'label':"Textual Inversion"},
#{'label':"Model Manager"},{'label':"Settings"}], #{'label':"Model Manager"},{'label':"Settings"}],
#horizontal_orientation=False, #horizontal_orientation=False,
#override_theme={'txc_inactive': 'white','menu_background':'#111', 'stVerticalBlock': '#111','txc_active':'yellow','option_active':'blue'}) #override_theme={'txc_inactive': 'white','menu_background':'#111', 'stVerticalBlock': '#111','txc_active':'yellow','option_active':'blue'})
if tabs =='Stable Diffusion': if tabs =='Stable Diffusion':
# set the page url and title # set the page url and title
st.experimental_set_query_params(page='stable-diffusion') st.experimental_set_query_params(page='stable-diffusion')
@ -128,50 +128,50 @@ def layout():
set_page_title("Stable Diffusion Playground") set_page_title("Stable Diffusion Playground")
except NameError: except NameError:
st.experimental_rerun() st.experimental_rerun()
txt2img_tab, img2img_tab, txt2vid_tab, img2txt_tab, concept_library_tab = st.tabs(["Text-to-Image", "Image-to-Image", txt2img_tab, img2img_tab, txt2vid_tab, img2txt_tab, concept_library_tab = st.tabs(["Text-to-Image", "Image-to-Image",
"Text-to-Video", "Image-To-Text", "Text-to-Video", "Image-To-Text",
"Concept Library"]) "Concept Library"])
#with home_tab: #with home_tab:
#from home import layout #from home import layout
#layout() #layout()
with txt2img_tab: with txt2img_tab:
from txt2img import layout from txt2img import layout
layout() layout()
with img2img_tab: with img2img_tab:
from img2img import layout from img2img import layout
layout() layout()
with txt2vid_tab: with txt2vid_tab:
from txt2vid import layout from txt2vid import layout
layout() layout()
with img2txt_tab: with img2txt_tab:
from img2txt import layout from img2txt import layout
layout() layout()
with concept_library_tab: with concept_library_tab:
from sd_concept_library import layout from sd_concept_library import layout
layout() layout()
# #
elif tabs == 'Model Manager': elif tabs == 'Model Manager':
set_page_title("Model Manager - Stable Diffusion Playground") set_page_title("Model Manager - Stable Diffusion Playground")
from ModelManager import layout from ModelManager import layout
layout() layout()
elif tabs == 'Textual Inversion': elif tabs == 'Textual Inversion':
from textual_inversion import layout from textual_inversion import layout
layout() layout()
elif tabs == 'Settings': elif tabs == 'Settings':
set_page_title("Settings - Stable Diffusion Playground") set_page_title("Settings - Stable Diffusion Playground")
from Settings import layout from Settings import layout
layout() layout()
if __name__ == '__main__': if __name__ == '__main__':
layout() layout()