AUTOMATIC1111 / stable-diffusion-webui

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

[Bug]: My AMD device cannot check CPU to run CPU mode? #16073

Open Lenbot-QC opened 3 months ago

Lenbot-QC commented 3 months ago

Checklist

What happened?

when i add "--skip-torch-cuda-test" to "webui-user.bat" and run it, it still scan "cu121" (cuda) to download and not scan "cpu". (tears of joy)

Steps to reproduce the problem

  1. download python 3.10.6 (conda install), git 2.45.2 (latest ver.), and git clone stable-diffusion-webui.
  2. add "--skip-torch-cuda-test" behind the line "set COMMANDLINE_ARGS=" in "webui-user.bat" file.
  3. run and get the problem.

What should have happened?

  1. first time i try to run directly, will download cu121.
  2. i try to read some python files, then go to "modules/launch_utils.py", and replace the text "cu121" as "cpu" then save, this time run "webui_user.bat".
  3. now i can download torch (cpu version), but after installing torch and torchvision, it still show error that i have to... add "--skip-torch-cuda-test" into "webui-user.bat"? (tears of joy again)

What browsers do you use to access the UI ?

No response

Sysinfo

Windows 10 LTSC 2019, build 17763.5696 AMD Ryzen 5 5600G, AMD Radeon Graphics (this is GPU so i won't use it), 16GB RAM

Console logs

(sd) C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui>.\webui-user.bat
Creating venv in directory C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\venv using python "C:\Users\Lenbot\miniconda3\envs\sd\python.exe"
venv "C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\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)]
Version: v1.9.4
Commit hash: feee37d75f1b168768014e4634dcb156ee649c05
Installing torch and torchvision
Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cu121  # the problem is here, so i press Ctrl+C when i met this.

ERROR: Operation cancelled by user

[notice] A new release of pip available: 22.2.1 -> 24.1
[notice] To update, run: C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip
Traceback (most recent call last):
  File "C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\launch.py", line 48, in <module>
    main()
  File "C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\launch.py", line 39, in main
    prepare_environment()
  File "C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\modules\launch_utils.py", line 380, in prepare_environment
    run(f'"{python}" -m {torch_command}', "Installing torch and torchvision", "Couldn't install torch", live=True)
  File "C:\Users\Lenbot\_Stable_Diffusion_WebUI\stable-diffusion-webui\modules\launch_utils.py", line 103, in run
    result = subprocess.run(**run_kwargs)
  File "C:\Users\Lenbot\miniconda3\envs\sd\lib\subprocess.py", line 503, in run
    stdout, stderr = process.communicate(input, timeout=timeout)
  File "C:\Users\Lenbot\miniconda3\envs\sd\lib\subprocess.py", line 1144, in communicate
    self.wait()
  File "C:\Users\Lenbot\miniconda3\envs\sd\lib\subprocess.py", line 1207, in wait
    return self._wait(timeout=timeout)
  File "C:\Users\Lenbot\miniconda3\envs\sd\lib\subprocess.py", line 1488, in _wait
    result = _winapi.WaitForSingleObject(self._handle,
KeyboardInterrupt
^C终止批处理操作吗(Y/N)? y

Additional information

the project can run well on 1.8.0 version (even i run well on my "Windows 11 on ARM" device), but 1.9.4 has this problem. so i can easily confuse on it. @_@

Lenbot-QC commented 3 months ago

and this is the console log after replacing "cu121" as "cpu" in "modules/launch_utils.py". oh, by the way, the same problem when run that project "stable-diffusion-webui-directml", that one is 1.9.3 version.

(sd) C:\Users\Lenbot_Stable_Diffusion_WebUI\stable-diffusion-webui>.\webui-user.bat venv "C:\Users\Lenbot_Stable_Diffusion_WebUI\stable-diffusion-webui\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)] Version: v1.9.4 Commit hash: feee37d75f1b168768014e4634dcb156ee649c05 Installing torch and torchvision Looking in indexes: https://pypi.org/simple, https://download.pytorch.org/whl/cpu Collecting torch==2.1.2 Using cached https://download.pytorch.org/whl/cpu/torch-2.1.2%2Bcpu-cp310-cp310-win_amd64.whl (194.4 MB) Collecting torchvision==0.16.2 Using cached https://download.pytorch.org/whl/cpu/torchvision-0.16.2%2Bcpu-cp310-cp310-win_amd64.whl (1.1 MB) Collecting filelock Using cached filelock-3.15.4-py3-none-any.whl (16 kB) Collecting sympy Using cached sympy-1.12.1-py3-none-any.whl (5.7 MB) Collecting jinja2 Using cached jinja2-3.1.4-py3-none-any.whl (133 kB) Collecting typing-extensions Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB) Collecting networkx Using cached networkx-3.3-py3-none-any.whl (1.7 MB) Collecting fsspec Using cached fsspec-2024.6.0-py3-none-any.whl (176 kB) Collecting numpy Using cached numpy-2.0.0-cp310-cp310-win_amd64.whl (16.5 MB) Collecting pillow!=8.3.*,>=5.3.0 Using cached pillow-10.3.0-cp310-cp310-win_amd64.whl (2.5 MB) Collecting requests Using cached requests-2.32.3-py3-none-any.whl (64 kB) Collecting MarkupSafe>=2.0 Using cached https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl (17 kB) Collecting idna<4,>=2.5 Using cached idna-3.7-py3-none-any.whl (66 kB) Collecting urllib3<3,>=1.21.1 Using cached urllib3-2.2.2-py3-none-any.whl (121 kB) Collecting charset-normalizer<4,>=2 Using cached charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl (100 kB) Collecting certifi>=2017.4.17 Using cached certifi-2024.6.2-py3-none-any.whl (164 kB) Collecting mpmath<1.4.0,>=1.1.0 Using cached https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl (536 kB) Installing collected packages: mpmath, urllib3, typing-extensions, sympy, pillow, numpy, networkx, MarkupSafe, idna, fsspec, filelock, charset-normalizer, certifi, requests, jinja2, torch, torchvision Successfully installed MarkupSafe-2.1.5 certifi-2024.6.2 charset-normalizer-3.3.2 filelock-3.15.4 fsspec-2024.6.0 idna-3.7 jinja2-3.1.4 mpmath-1.3.0 networkx-3.3 numpy-2.0.0 pillow-10.3.0 requests-2.32.3 sympy-1.12.1 torch-2.1.2+cpu torchvision-0.16.2+cpu typing-extensions-4.12.2 urllib3-2.2.2

[notice] A new release of pip available: 22.2.1 -> 24.1 [notice] To update, run: C:\Users\Lenbot_Stable_Diffusion_WebUI\stable-diffusion-webui\venv\Scripts\python.exe -m pip install --upgrade pip Traceback (most recent call last): File "C:\Users\Lenbot_Stable_Diffusion_WebUI\stable-diffusion-webui\launch.py", line 48, in main() File "C:\Users\Lenbot_Stable_Diffusion_WebUI\stable-diffusion-webui\launch.py", line 39, in main prepare_environment() File "C:\Users\Lenbot_Stable_Diffusion_WebUI\stable-diffusion-webui\modules\launch_utils.py", line 386, in prepare_environment raise RuntimeError( RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check 请按任意键继续. . .