lshqqytiger / stable-diffusion-webui-amdgpu

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

[Bug]: raise AttributeError #404

Closed Yukiiruu closed 2 months ago

Yukiiruu commented 4 months ago

Checklist

What happened?

Hello, i need help, im trying to install stable diffusion with my AMD GPU, but don't work..

(f"module '{name}' has no attribute '{name}'") AttributeError: module 'torch' has no attribute 'dml'

Steps to reproduce the problem

I double-click the webui-user.bat and it says

What should have happened?

I don't understand

What browsers do you use to access the UI ?

No response

Sysinfo

don't understand

Console logs

venv "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: 1.8.0-RC
Commit hash: 25a3b6cbeea8a07afd5e4594afc2f1c79f41ac1a
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\venv\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: `pytorch_lightning.utilities.distributed.rank_zero_only` has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from `pytorch_lightning.utilities` instead.
  rank_zero_deprecation(
Launching Web UI with arguments: --skip-torch-cuda-test --use-directml --opt-sub-quad-attention --upcast-sampling --theme=dark --disable-nan-check
DirectML initialization failed: No module named 'torch_directml'
C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\venv\lib\site-packages\diffusers\utils\outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.
  torch.utils._pytree._register_pytree_node(
Traceback (most recent call last):
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\launch.py", line 48, in <module>
    main()
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\launch.py", line 44, in main
    start()
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\modules\launch_utils.py", line 663, in start
    import webui
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\webui.py", line 13, in <module>
    initialize.imports()
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\modules\initialize.py", line 36, in imports
    shared_init.initialize()
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\modules\shared_init.py", line 31, in initialize
    directml_do_hijack()
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\modules\dml\__init__.py", line 76, in directml_do_hijack
    if not torch.dml.has_float64_support(device):
  File "C:\Users\Utilisateur\Desktop\azeaze\sd-test\stable-diffusion-webui-directml\venv\lib\site-packages\torch\__init__.py", line 1932, in __getattr__
    raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
AttributeError: module 'torch' has no attribute 'dml'
Appuyez sur une touche pour continuer...

Additional information

No response

Yukiiruu commented 4 months ago

and now i have this problem : image

Lethaquell commented 4 months ago

@Yukiiruu I've managed to fix this in a few steps:

  1. Edit requirements.txt, add new line with torch-directml
  2. Execute venv/Scripts/activate
  3. pip install -r requirements.txt
lshqqytiger commented 2 months ago

Simple solution: remove venv folder Accurate solution:

.\venv\Scripts\activate
pip uninstall torch torchvision -y
pip install torch==2.0.0 torchvision torch-directml