Sygil-Dev / sygil-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
7.87k stars 883 forks source link

[Bug]: Webui-Streamlit: 'st.session_state has no key "use_LDSR"' #1522

Closed 9of9 closed 1 year ago

9of9 commented 1 year ago

What happened?

When attempting txt2image with webui, two exceptions are caught in the console instead of correctly generating the image. They first is a key error within session state, and then a LDSR-related exception in session state. I do have LDSR installed, but I'm not even attempting to use it. This is on a fresh conda environment.

Version

0.0.1 (Default)

What browsers are you seeing the problem on?

Chrome

Where are you running the webui?

Windows

Custom settings

No response

Relevant log output

2022-10-14 13:20:05.154 Uncaught app exception
Traceback (most recent call last):
  File "D:\Projects\Anaconda\envs\ldm\lib\site-packages\streamlit\runtime\state\session_state.py", line 438, in __getitem__
    return self._getitem(widget_id, key)
  File "D:\Projects\Anaconda\envs\ldm\lib\site-packages\streamlit\runtime\state\session_state.py", line 482, in _getitem
    raise KeyError
KeyError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Projects\Anaconda\envs\ldm\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 562, in _run_script
    exec(code, module.__dict__)
  File "D:\OneDrive\ML\stable-diffusion-webui\scripts\webui_streamlit.py", line 177, in <module>
    layout()
  File "D:\OneDrive\ML\stable-diffusion-webui\scripts\webui_streamlit.py", line 141, in layout
    layout()
  File "scripts\txt2img.py", line 407, in layout
    load_models(use_LDSR=st.session_state["use_LDSR"], LDSR_model=st.session_state["LDSR_model"],
  File "D:\Projects\Anaconda\envs\ldm\lib\site-packages\streamlit\runtime\state\session_state_proxy.py", line 93, in __getitem__
    return get_session_state()[key]
  File "D:\Projects\Anaconda\envs\ldm\lib\site-packages\streamlit\runtime\state\safe_session_state.py", line 111, in __getitem__
    return self._state[key]
  File "D:\Projects\Anaconda\envs\ldm\lib\site-packages\streamlit\runtime\state\session_state.py", line 440, in __getitem__
    raise KeyError(_missing_key_error_message(key))
KeyError: 'st.session_state has no key "use_LDSR". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization'

Code of Conduct

MosJef0 commented 1 year ago

Getting the same error after being fully updated on the repo:

KeyError: 'st.session_state has no key "use_LDSR". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization' Traceback: File "C:\Users\jeffm.conda\envs\ldm\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 562, in _run_script exec(code, module.dict) File "C:\Users\jeffm\stable-diffusion-webui\scripts\webui_streamlit.py", line 177, in layout() File "C:\Users\jeffm\stable-diffusion-webui\scripts\webui_streamlit.py", line 141, in layout layout() File "scripts\txt2img.py", line 407, in layout load_models(use_LDSR=st.session_state["use_LDSR"], LDSR_model=st.session_state["LDSR_model"], File "C:\Users\jeffm.conda\envs\ldm\lib\site-packages\streamlit\runtime\state\session_state_proxy.py", line 93, in getitem return get_session_state()[key] File "C:\Users\jeffm.conda\envs\ldm\lib\site-packages\streamlit\runtime\state\safe_session_state.py", line 111, in getitem return self._state[key] File "C:\Users\jeffm.conda\envs\ldm\lib\site-packages\streamlit\runtime\state\session_state.py", line 440, in getitem raise KeyError(_missing_key_error_message(key))

Yrbashazar commented 1 year ago

same error

vkordic commented 1 year ago

You need to look at the output of the script you are running (webui.sh) because something in its startup went wrong. In my case I was missing wget and unzip so the script couldn't download LDSR.

To solve this, use Cygwin or something equivalent to install missing programs.