stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Streamlit txt2vid does not handle a missing Hugging Face Token

Open cstueckrath opened this issue 4 years ago • 4 comments

What happened?

If you run txt2vid from scratch, an exception occurs, if you have not provided a Hugging face token "somewhere"

Expected: Catch Exception and display how to get and where to put that token

Workaround: Put your token as string in lines after use_auth_token= instead of True

Version

0.0.1 (Default)

What browsers are you seeing the problem on?

Chrome

Where are you running the webui?

Linux

Custom settings

No response

Relevant log output

Uncaught app exception
Traceback (most recent call last):
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/streamlit/runtime/state/session_state.py", line 438, in __getitem__
    return self._getitem(widget_id, key)
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/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 "/home/cstueckrath/rocm/stable-diffusion-webui/scripts/webui_streamlit.py", line 1833, in txt2vid
    if not st.session_state["pipe"] or st.session_state["weights_path"] != weights_path:
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/streamlit/runtime/state/session_state_proxy.py", line 93, in __getitem__
    return get_session_state()[key]
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/streamlit/runtime/state/safe_session_state.py", line 111, in __getitem__
    return self._state[key]
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/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 "pipe". Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 556, in _run_script
    exec(code, module.__dict__)
  File "/home/cstueckrath/rocm/stable-diffusion-webui/scripts/webui_streamlit.py", line 2514, in <module>
    layout()
  File "/home/cstueckrath/rocm/stable-diffusion-webui/scripts/webui_streamlit.py", line 2462, in layout
    image, seed, info= txt2vid(prompts=prompt, gpu=defaults.general.gpu,
  File "/home/cstueckrath/rocm/stable-diffusion-webui/scripts/webui_streamlit.py", line 1857, in txt2vid
    st.session_state["pipe"] = StableDiffusionPipeline.from_pretrained(
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/diffusers/pipeline_utils.py", line 154, in from_pretrained
    cached_folder = snapshot_download(
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/huggingface_hub/utils/_deprecation.py", line 93, in inner_f
    return f(*args, **kwargs)
  File "/home/cstueckrath/anaconda3/envs/lsd/lib/python3.8/site-packages/huggingface_hub/_snapshot_download.py", line 115, in snapshot_download
    raise EnvironmentError(
OSError: You specified use_auth_token=True, but a Hugging Face token was not found.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

cstueckrath avatar Sep 12 '22 07:09 cstueckrath

You are right, I didn't consider this case as I already had my token added, I will be however making a Settings page where you can add your own settings and there is already a user_config_streamlit.yaml that you can create and have your custom settings there so I will be making use of that to save some stuff including the HF token.

ZeroCool940711 avatar Sep 12 '22 08:09 ZeroCool940711

sounds good. btw: the Light view with the new css has a problem with the upper tabs on (at least) Chrome. Dark mode works. It's just a minor thing, as you can still reach the text. But just wanted you to know ;)

cstueckrath avatar Sep 12 '22 08:09 cstueckrath

yeah, its a known issue, thats why I made it so the default theme when using the cmd file is the dark theme as most people still use it instead of light theme.

ZeroCool940711 avatar Sep 12 '22 09:09 ZeroCool940711

BTW, you do not seem to be on the discord server for the repo, are you? If you are not then join us there, it's easier to talk there than spamming GitHub issues, here is the link.

ZeroCool940711 avatar Sep 12 '22 09:09 ZeroCool940711