thygate / stable-diffusion-webui-depthmap-script

High Resolution Depth Maps for Stable Diffusion WebUI
MIT License
1.66k stars 153 forks source link

ModuleNotFoundError: No module named 'timm.models.beit' #129

Open TriumHash opened 1 year ago

TriumHash commented 1 year ago

Error loading script: depthmap.py ModuleNotFoundError: No module named 'timm.models.beit'

I got this error, and stuck in this error. The extention tab for Depthmap does not show up in webUI probably because of this. So i tried to pip install timm and even indicated the version as 0.6.12. I installed it in miniconda3 and python310, and i even installed it into the venv directory of WebUI. stable-diffusion-webui\venv\Lib\site-packages

But when i started webUI, It showed the same error. And when i check the stable-diffusion-webui\venv\Lib\site-packages directory, timm was rolled backed into the 0.4.12 version. Even when i tried to manually transport it to somewhere else, and copy and paste timm 0.6.12 from python310, When i started WebUI, It just get back to older version.

I think it's because of the WebUI's settings or codes or something. Is there anybody else having same problem with me? What can i do in this situation?

P.S. I also installed cd stable-diffusion-webui/repositories && git clone https://github.com/isl-org/MiDaS midas && cd midas && git checkout b845b78. But seems like it has nothing to do with this problem.

hdvrai commented 1 year ago

Same issue. Looking for a fix

mykeehu commented 1 year ago

I've had the same problem for several weeks, only on Colab, not on Windows. No solution has been found yet, so I can't use it on Colab.

thygate commented 1 year ago

Have you tried this https://github.com/thygate/stable-diffusion-webui-depthmap-script/issues/74#issuecomment-1414519109 ?

mykeehu commented 1 year ago

@thygate I ran those two commands on Colab, before starting WebUI. I then got this error when loading the WebUI:

/usr/local/lib/python3.9/dist-packages/torchvision/transforms/functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional.
  warnings.warn(
Traceback (most recent call last):
  File "/content/stable-diffusion-webui/launch.py", line 381, in <module>
    start()
  File "/content/stable-diffusion-webui/launch.py", line 372, in start
    import webui
  File "/content/stable-diffusion-webui/webui.py", line 28, in <module>
    from modules import extra_networks, ui_extra_networks_checkpoints
  File "/content/stable-diffusion-webui/modules/ui_extra_networks_checkpoints.py", line 5, in <module>
    from modules import shared, ui_extra_networks, sd_models
  File "/content/stable-diffusion-webui/modules/sd_models.py", line 17, in <module>
    from modules.sd_hijack_inpainting import do_inpainting_hijack
  File "/content/stable-diffusion-webui/modules/sd_hijack_inpainting.py", line 7, in <module>
    import ldm.models.diffusion.ddpm
  File "/content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py", line 12, in <module>
    import pytorch_lightning as pl
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/__init__.py", line 34, in <module>
    from pytorch_lightning.callbacks import Callback  # noqa: E402
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/callbacks/__init__.py", line 14, in <module>
    from pytorch_lightning.callbacks.callback import Callback
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/callbacks/callback.py", line 25, in <module>
    from pytorch_lightning.utilities.types import STEP_OUTPUT
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/__init__.py", line 18, in <module>
    from pytorch_lightning.utilities.apply_func import move_data_to_device  # noqa: F401
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/apply_func.py", line 29, in <module>
    from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/imports.py", line 153, in <module>
    _TORCHTEXT_LEGACY: bool = _TORCHTEXT_AVAILABLE and _compare_version("torchtext", operator.lt, "0.11.0")
  File "/usr/local/lib/python3.9/dist-packages/pytorch_lightning/utilities/imports.py", line 71, in _compare_version
    pkg = importlib.import_module(package)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/local/lib/python3.9/dist-packages/torchtext/__init__.py", line 6, in <module>
    from torchtext import _extension  # noqa: F401
  File "/usr/local/lib/python3.9/dist-packages/torchtext/_extension.py", line 64, in <module>
    _init_extension()
  File "/usr/local/lib/python3.9/dist-packages/torchtext/_extension.py", line 58, in _init_extension
    _load_lib("libtorchtext")
  File "/usr/local/lib/python3.9/dist-packages/torchtext/_extension.py", line 50, in _load_lib
    torch.ops.load_library(path)
  File "/usr/local/lib/python3.9/dist-packages/torch/_ops.py", line 643, in load_library
    ctypes.CDLL(path)
  File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/python3.9/dist-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZN2at4_ops10select_int4callERKNS_6TensorEll

If I switch to 3.8 python, the runtime environment crashes on reboot. So it was not good for the start.

I tried it on python 3.8.10, on Colab, without @rockerBOO's "fix", and got this, I guess it's not compatible with python 3.8:

Error loading script: depthmap.py
Traceback (most recent call last):
  File "/content/stable-diffusion-webui/modules/scripts.py", line 248, in load_scripts
    script_module = script_loading.load_module(scriptfile.path)
  File "/content/stable-diffusion-webui/modules/script_loading.py", line 11, in load_module
    module_spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/content/stable-diffusion-webui/extensions/stable-diffusion-webui-depthmap-script/scripts/depthmap.py", line 14, in <module>
    from numba import njit, prange
  File "/usr/local/lib/python3.8/dist-packages/numba/__init__.py", line 42, in <module>
    from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
  File "/usr/local/lib/python3.8/dist-packages/numba/np/ufunc/__init__.py", line 3, in <module>
    from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
  File "/usr/local/lib/python3.8/dist-packages/numba/np/ufunc/decorators.py", line 3, in <module>
    from numba.np.ufunc import _internal
SystemError: initialization of _internal failed without raising an exception
thygate commented 1 year ago

OSError: /usr/local/lib/python3.9/dist-packages/torchtext/lib/libtorchtext.so: undefined symbol: _ZN2at4_ops10select_int4callERKNS_6TensorEll

This seems to be due to an incompatibility between torch and torchtext. Reinstall torchtext with the current version of pytorch.

pip uninstall torchtext pip install torchtext

Rogal80 commented 1 year ago

same here : Error loading script: depthmap.py Traceback (most recent call last): File "I:\Github\Web_UI\webui\modules\scripts.py", line 256, in load_scripts script_module = script_loading.load_module(scriptfile.path) File "I:\Github\Web_UI\webui\modules\script_loading.py", line 11, in load_module module_spec.loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "I:\Github\Web_UI\webui\extensions\stable-diffusion-webui-depthmap-script\scripts\depthmap.py", line 42, in from dmidas.dpt_depth import DPTDepthModel File "I:\Github\Web_UI\webui\extensions/stable-diffusion-webui-depthmap-script/scripts\dmidas\dpt_depth.py", line 5, in from .blocks import ( File "I:\Github\Web_UI\webui\extensions/stable-diffusion-webui-depthmap-script/scripts\dmidas\blocks.py", line 4, in from .backbones.beit import ( File "I:\Github\Web_UI\webui\extensions/stable-diffusion-webui-depthmap-script/scripts\dmidas\backbones\beit.py", line 9, in from timm.models.beit import gen_relative_position_index ModuleNotFoundError: No module named 'timm.models.beit'