lllyasviel / lllyasviel/stable-diffusion-webui-forge
[Bug]: --directml halts when loading torch
- Dominant language
- Python
- Stars
- 13k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist
- [X] The issue exists after disabling all extensions
- [X] The issue exists on a clean installation of webui
- [ ] The issue is caused by an extension, but I believe it is caused by a bug in the webui
- [X] The issue exists in the current version of the webui
- [X] The issue has not been reported before recently
- [ ] The issue has been reported before but has not been fixed yet
### What happened?
I cloned Forge from the GitHub using the instructions on the GitHub and added --directml to COMMANDLINE_ARGS as I am using an AMD card. First run of webui-user.bat installed everything but halted when trying to load torch with the instruction to add --skip-torch-cuda-test to COMMANDLINE_ARGS. After adding --skip-torch-cuda-test, I ran it again and it halted with the notification "No module called 'torch-directml'.
### Steps to reproduce the problem
1. Clone the Forge repository using git
2. Edit webui-user.bat to contain --directml and --skip-torch-cuda-test for COMMANDLINE_ARGS
3. Save webui-user.bat and launch it
### What should have happened?
Forge should launch normally and allow access to its interface via browser.
### What browsers do you use to access the UI ?
Mozilla Firefox, Google Chrome, Microsoft Edge
### Sysinfo
[sysinfo-2024-03-28-10-51.json](https://github.com/lllyasviel/stable-diffusion-webui-forge/files/15366441/sysinfo-2024-03-28-10-51.json)
### Console logs
```Shell
c:\stable-diffusion\stable-diffusion-webui-forge>webui-user.bat
venv "c:\stable-diffusion\stable-diffusion-webui-forge\venv\Scripts\Python.exe"
Python 3.10.13 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:24:38) [MSC v.1916 64 bit (AMD64)]
Version: f0.0.17v1.8.0rc-latest-276-g29be1da7
Commit hash: 29be1da7cf2b5dccfc70fbdd33eb35c56a31ffb7
Launching Web UI with arguments: --directml --skip-torch-cuda-test --update-torch
Traceback (most recent call last):
File "c:\stable-diffusion\stable-diffusion-webui-forge\launch.py", line 51, in
main()
File "c:\stable-diffusion\stable-diffusion-webui-forge\launch.py", line 47, in main
start()
File "c:\stable-diffusion\stable-diffusion-webui-forge\modules\launch_utils.py", line 541, in start
import webui
File "c:\stable-diffusion\stable-diffusion-webui-forge\webui.py", line 17, in
initialize_forge()
File "c:\stable-diffusion\stable-diffusion-webui-forge\modules_forge\initialization.py", line 50, in initialize_forge
import ldm_patched.modules.model_management as model_management
File "c:\stable-diffusion\stable-diffusion-webui-forge\ldm_patched\modules\model_management.py", line 43, in
import torch_directml
ModuleNotFoundError: No module named 'torch_directml'
Press any key to continue . . .
```
### Additional information
Sysinfo is from a working installation of Automatic1111.
Console log from attempting to use --dump-sysinfo:
c:\stable-diffusion\stable-diffusion-webui-forge>webui-user.bat
venv "c:\stable-diffusion\stable-diffusion-webui-forge\venv\Scripts\Python.exe"
Traceback (most recent call last):
File "c:\stable-diffusion\stable-diffusion-webui-forge\launch.py", line 51, in
main()
File "c:\stable-diffusion\stable-diffusion-webui-forge\launch.py", line 29, in main
filename = launch_utils.dump_sysinfo()
File "c:\stable-diffusion\stable-diffusion-webui-forge\modules\launch_utils.py", line 554, in dump_sysinfo
from modules import sysinfo
File "c:\stable-diffusion\stable-diffusion-webui-forge\modules\sysinfo.py", line 12, in
from modules import paths_internal, timer, shared, extensions, errors
File "c:\stable-diffusion\stable-diffusion-webui-forge\modules\shared.py", line 4, in
import gradio as gr
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\__init__.py", line 3, in
import gradio.components as components
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\components\__init__.py", line 1, in
from gradio.components.annotated_image import AnnotatedImage
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\components\annotated_image.py", line 13, in
from gradio.components.base import IOComponent, _Keywords
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\components\base.py", line 20, in
from fastapi import UploadFile
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\__init__.py", line 7, in
from .applications import FastAPI as FastAPI
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\applications.py", line 15, in
from fastapi import routing
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\routing.py", line 22, in
from fastapi import params
File "c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\params.py", line 4, in
from pydantic.fields import FieldInfo, Undefined
ImportError: cannot import name 'Undefined' from 'pydantic.fields' (c:\stable-diffusion\stable-diffusion-webui-forge\venv\lib\site-packages\pydantic\fields.py)
Press any key to continue . . .
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with modules_forge/initialization.py and ldm_patched/modules/model_management.py, then reproduce the launch using --directml and --skip-torch-cuda-test. Trace how the environment installs or imports the DirectML dependency and compare the separate FastAPI/Pydantic failure from the sysinfo command. Done means a clean installation launches Forge with the documented arguments and reaches the browser interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100