AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: #13408

Open Gouvernathor opened 11 months ago

Gouvernathor commented 11 months ago

Is there an existing issue for this?

What happened?

When creating a new embedding, exception with traceback.

Traceback (most recent call last):
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\modules\textual_inversion\ui.py", line 11, in create_embedding
    filename = modules.textual_inversion.textual_inversion.create_embedding(name, nvpt, overwrite_old, init_text=initialization_text)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\modules\textual_inversion\textual_inversion.py", line 292, in create_embedding
    cond_model([""])  # will send cond model to GPU if lowvram/medvram is active
    ^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\repositories\generative-models\sgm\modules\encoders\modules.py", line 141, in forward
    emb_out = embedder(batch[embedder.input_key])
                       ~~~~~^^^^^^^^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

Steps to reproduce the problem

"Train" tab "Create embedding" subtab Set a name and initialisation text Click "Create embedding"

What should have happened?

It should have created an empty embedding, instead it shows the word "error" and pops a traceback in the console.

Sysinfo

sysinfo-2023-09-26-21-23.txt

What browsers do you use to access the UI ?

Mozilla Firefox

Console logs

venv "D:\stable-diffusion-webui\venv\Scripts\Python.exe"
==============================================================================================================
INCOMPATIBLE PYTHON VERSION

This program is tested with 3.10.6 Python, but you have 3.11.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.

You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3106/

Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases

Use --skip-python-version-check to suppress this warning.
==============================================================================================================
Python 3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Launching Web UI with arguments: --no-half-vae
No module 'xformers'. Proceeding without it.
Loading weights [ca4802bc3f] from D:\stable-diffusion-webui\models\Stable-diffusion\juggernautXL_version45.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Creating model from config: D:\stable-diffusion-webui\repositories\generative-models\configs\inference\sd_xl_base.yaml
Startup time: 51.2s (prepare environment: 17.6s, import torch: 12.7s, import gradio: 8.5s, setup paths: 3.7s, import ldm: 0.1s, initialize shared: 0.9s, other imports: 5.7s, setup codeformer: 0.6s, setup gfpgan: 0.2s, load scripts: 0.7s, create ui: 0.5s, gradio launch: 0.6s).
Applying attention optimization: Doggettx... done.
Calculating sha256 for D:\stable-diffusion-webui\embeddings\ppaviaold.pt: 3fd5abb1cd43964b1be7fb1515ee4cc44b5c0d6871c87cc238008b5b9f44e9fb
Model loaded in 28.4s (load weights from disk: 1.0s, create model: 0.7s, apply weights to model: 3.3s, apply dtype to VAE: 10.9s, move model to device: 0.3s, calculate empty prompt: 12.0s).
Traceback (most recent call last):
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\modules\textual_inversion\ui.py", line 11, in create_embedding
    filename = modules.textual_inversion.textual_inversion.create_embedding(name, nvpt, overwrite_old, init_text=initialization_text)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\modules\textual_inversion\textual_inversion.py", line 292, in create_embedding
    cond_model([""])  # will send cond model to GPU if lowvram/medvram is active
    ^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\venv\Lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\stable-diffusion-webui\repositories\generative-models\sgm\modules\encoders\modules.py", line 141, in forward
    emb_out = embedder(batch[embedder.input_key])
                       ~~~~~^^^^^^^^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not str

Additional information

I'm using --no-half-vae.

missionfloyd commented 11 months ago
INCOMPATIBLE PYTHON VERSION

This program is tested with 3.10.6 Python, but you have 3.11.2.
If you encounter an error with "RuntimeError: Couldn't install torch." message,
or any other error regarding unsuccessful package (library) installation,
please downgrade (or upgrade) to the latest version of 3.10 Python
and delete current Python and "venv" folder in WebUI's directory.

You can download 3.10 Python from here: https://www.python.org/downloads/release/python-3106/

Alternatively, use a binary release of WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases

The training tab is outdated and may be removed in the future (https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/11857#discussioncomment-6480804).

Try this instead. https://github.com/bmaltais/kohya_ss