Skip to content

Latest commit

 

History

History
111 lines (90 loc) · 3.2 KB

wsl-directml.adoc

File metadata and controls

111 lines (90 loc) · 3.2 KB

Run ComfyUI on WSL2 with DirectML

1. Install base packages

Note
Using Python 3.10 because of DirectML support
sudo zypper install --no-confirm \
    python310 python310-pip \
    python310-wheel python310-setuptools python310-numpy \
    git aria2 \
    Mesa-libGL1 libgthread-2_0-0

(optional) Install packages for ComfyUI InstantID

sudo zypper install --no-confirm \
    python310-devel python310-Cython \
    gcc-c++ cmake

(optional) Set proxy if needed

PIP proxy
sudo pip3.10 config set global.proxy http://host.docker.internal:1081

sudo pip3.10 install --upgrade pip
Temporary system proxy
export HTTP_PROXY=http://host.docker.internal:1081
export HTTPS_PROXY=$HTTP_PROXY
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTP_PROXY
export NO_PROXY="localhost,*.local,*.internal,[::1],fd00::/7,
10.0.0.0/8,127.0.0.0/8,169.254.0.0/16,172.16.0.0/12,192.168.0.0/16"
export no_proxy=$NO_PROXY

2. Install Torch-DirectML (with PyTorch)

sudo pip3.10 install --break-system-packages \
    torch-directml torchvision torchaudio \
    --index-url https://download.pytorch.org/whl/cpu \
    --extra-index-url https://pypi.org/simple

3. Install dependencies for ComfyUI

sudo pip3.10 install --break-system-packages \
    -r https://raw.githubusercontent.com/comfyanonymous/ComfyUI/master/requirements.txt \
    -r https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/requirements.txt

(optional) Install deps for ControlNet Auxiliary Preprocessors

sudo pip3.10 install --break-system-packages \
    -r https://raw.githubusercontent.com/Fannovel16/comfyui_controlnet_aux/main/requirements.txt \
    --extra-index-url https://download.pytorch.org/whl/cpu

(optional) Install deps for ComfyUI InstantID

sudo pip3.10 install --break-system-packages \
    -r https://raw.githubusercontent.com/ZHO-ZHO-ZHO/ComfyUI-InstantID/main/requirements.txt

4. Download ComfyUI

git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules \
    https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI

5. Download ComfyUI Manager

cd custom_nodes
git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules \
    https://github.com/ltdrdata/ComfyUI-Manager.git
cd ..

(optional) Download Models

cd models
aria2c https://raw.githubusercontent.com/YanWenKun/ComfyUI-Docker/main/cu121/scripts/download-models.txt
aria2c --allow-overwrite=false --auto-file-renaming=false --continue=true \
    --max-connection-per-server=5 --input-file=download-models.txt
cd ..

6. Run ComfyUI

python3.10 main.py --listen --port 8188 --directml
Tip
For <4G VRAM, add arg: --lowvram