AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: No module named 'timm.models.beit' #9747

Closed HWiese1980 closed 1 year ago

HWiese1980 commented 1 year ago

Is there an existing issue for this?

What happened?

I'm getting the following error with a freshly installed venv upon calling depth-related ControlNet preprocessors.

Traceback (most recent call last):
  File "K:\stablediffusionwebui\venv\lib\site-packages\gradio\routes.py", line 394, in run_predict
    output = await app.get_blocks().process_api(
  File "K:\stablediffusionwebui\venv\lib\site-packages\gradio\blocks.py", line 1075, in process_api
    result = await self.call_function(
  File "K:\stablediffusionwebui\venv\lib\site-packages\gradio\blocks.py", line 884, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "K:\stablediffusionwebui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "K:\stablediffusionwebui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "K:\stablediffusionwebui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\scripts\controlnet.py", line 399, in run_annotator
    result, is_image = preprocessor(img, res=pres, thr_a=pthr_a, thr_b=pthr_b)
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\scripts\processor.py", line 427, in zoe_depth
    result = model_zoe_depth(img)
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\__init__.py", line 38, in __call__
    self.load_model()
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\__init__.py", line 27, in load_model
    model = ZoeDepth.build_from_config(conf)
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\zoedepth\zoedepth_v1.py", line 250, in build_from_config
    return ZoeDepth.build(**config)
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\zoedepth\zoedepth_v1.py", line 240, in build
    core = MidasCore.build(midas_model_type=midas_model_type, use_pretrained_midas=use_pretrained_midas,
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\base_models\midas.py", line 343, in build
    midas = torch.hub.load(midas_path, midas_model_type,
  File "K:\stablediffusionwebui\venv\lib\site-packages\torch\hub.py", line 542, in load
    model = _load_local(repo_or_dir, model, *args, **kwargs)
  File "K:\stablediffusionwebui\venv\lib\site-packages\torch\hub.py", line 569, in _load_local
    hub_module = _import_module(MODULE_HUBCONF, hubconf_path)
  File "K:\stablediffusionwebui\venv\lib\site-packages\torch\hub.py", line 90, in _import_module
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\base_models\midas_repo\hubconf.py", line 5, in <module>
    from midas.dpt_depth import DPTDepthModel
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\base_models\midas_repo\midas\dpt_depth.py", line 5, in <module>
    from .blocks import (
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\base_models\midas_repo\midas\blocks.py", line 4, in <module>
    from .backbones.beit import (
  File "K:\stablediffusionwebui\extensions\sd-webui-controlnet\annotator\zoe\zoedepth\models\base_models\midas_repo\midas\backbones\beit.py", line 9, in <module>
    from timm.models.beit import gen_relative_position_index
ModuleNotFoundError: No module named 'timm.models.beit'

Steps to reproduce the problem

I have no idea if and how this might be reproducable...

What should have happened?

Well, the error should not have occurred in the first place. Depth delated stuff should work.

Commit where the problem happens

d75b3fb2f0f6b7794898b7baaa90e0a097586fda

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

--xformers --listen --enable-insecure-extension-access --api --cors-allow-origins-regex="https?://((localhost|127\.0\.0\.1|192\.168\.\d+\.\d+):\d+|example\.com)"

List of extensions


Console logs

Already up to date.
venv "K:\stablediffusionwebui\venv\Scripts\Python.exe"
Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Commit hash: d75b3fb2f0f6b7794898b7baaa90e0a097586fda
Installing requirements for Web UI
Installing sd-webui-controlnet requirement: mediapipe==0.9.1.0
Installing sd-webui-controlnet requirement: opencv-python

Installing requirements for Unprompted - img2pez
Installing requirements for Unprompted - pix2pix_zero
Installing requirements for Unprompted - zoom_enhance

Launching Web UI with arguments: --xformers --listen --enable-insecure-extension-access --api --cors-allow-origins-regex=https?://((localhost|127\.0\.0\.1|192\.168\.\d+\.\d+):\d+|example\.com)
Civitai Helper: Get Custom Model Folder
Civitai Helper: Load setting from: K:\stablediffusionwebui\extensions\Stable-Diffusion-Webui-Civitai-Helper\setting.json
Civitai Helper: No setting file, use default
Loading Unprompted v8.2.0 by Therefore Games
(SETUP) Initializing Unprompted object...
(SETUP) Loading configuration files...
(SETUP) Debug mode is False
Loading weights [9aba26abdf] from K:\stablediffusionwebui\models\Stable-diffusion\deliberate_v2.safetensors
Creating model from config: K:\stablediffusionwebui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: K:\stablediffusionwebui\models\VAE\vae-ft-mse-840000-ema-pruned.ckpt
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(26): *****
Model loaded in 4.8s (load weights from disk: 0.3s, create model: 0.7s, apply weights to model: 0.8s, apply half(): 0.8s, load VAE: 0.3s, move model to device: 0.8s, load textual inversion embeddings: 1.1s).
Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 24.9s (import torch: 2.9s, import gradio: 2.2s, import ldm: 0.7s, other imports: 1.6s, setup codeformer: 0.1s, load scripts: 3.5s, load SD checkpoint: 5.0s, create ui: 4.4s, gradio launch: 4.3s).

Additional information

No response

GrennKren commented 1 year ago

Then you should create the issue on that related extensions.. sd-webui-controlnet

HWiese1980 commented 1 year ago

It happens with other extensions too that use midas depth. Deforum for example. Is it still an extension related issue if it happens with multiple extensions?

HWiese1980 commented 1 year ago

Opened another similar issue in the sd-webui-controlnet repo.

akx commented 1 year ago

Closing as this is clearly an sd-webui-controlnet issue.

ExtensionURLVersionUpdate
https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helperfcf5a27a (Fri Apr 14 05:39:01 2023)unknown
https://github.com/richrobber2/canvas-zoom.gitad6f45c3 (Sun Apr 16 23:53:36 2023)unknown
https://github.com/thomasasfk/sd-webui-aspect-ratio-helper.gitb03cce20 (Mon Apr 10 21:17:00 2023)unknown
https://github.com/Mikubill/sd-webui-controlnet937e8f07 (Wed Apr 19 09:35:06 2023)unknown
https://github.com/Gerschel/sd_web_ui_preset_utils175b6f7d (Mon Jan 30 15:07:50 2023)unknown
https://github.com/klimaleksus/stable-diffusion-webui-fix-image-paste2844e17e (Fri Feb 24 22:31:57 2023)unknown
https://github.com/AlUlkesh/stable-diffusion-webui-images-browser0029d95a (Fri Apr 14 06:11:06 2023)unknown
https://github.com/Coyote-A/ultimate-upscale-for-automatic11110a3d03a4 (Tue Feb 7 06:07:23 2023)unknown
https://github.com/ThereforeGames/unprompted8f6edd9d (Wed Apr 19 02:49:49 2023)unknown
built-in
built-in
built-in
built-in
built-in