ComfyUI with DirectML
This guide is recommended if you have an Old AMD Card, Intel Card or Integrated Card and Zluda didn't work for you. DirectML will be slower but it's your last option.
Requirements
- Windows 10/11
- Python 3.10 (The version is very important)
- Git
Make sure you check the box "Add Python 3.10 to PATH" at the very beginning of the python installer. If you did it, typing python --version on your terminal should return Python 3.10.xx, meaning you're good to go.
Quick installation (Recommended)
- Paste this command on your terminal to clone ComfyUI
git clone https://github.com/Comfy-Org/ComfyUI.git - In the new
ComfyUI/folder (where is requirements.txt), create arun.batfile and paste this script inside of it. - Execute the
run.bat; Do it every time you want to use ComfyUI again.
Normal installation
- Cloning ComfyUI
git clone https://github.com/Comfy-Org/ComfyUI.git - Get in ComfyUI folder
cd ComfyUI - Install Requirements
pip install -r requirements.txt
Normally ComfyUI installs the CUDA version of torch, we don't want that, so we will replace it with directml version. - Force install torch-directml;
pip install torch-directml torchvision torchaudio sqlalchemy --upgrade
You can skip the next step but it's an essential extension that you will need in the future - Install ComfyUI-Manager extension
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd .. - Run ComfyUI
python main.py --directml --force-fp16 --lowvram --preview-method auto --use-split-cross-attention --auto-launch
Some ComfyUI Updates or Extension Updates/Installations might replace your DirectML torch (torch-directml) back with the CUDA one (torch) without your consent so ComfyUI will eventually crash. If this happens, you need to repeat step 4 again before running it. That's why this script is so convenient, it's the step 2 of the Quick Installation and you can use it even if you've already followed the whole Normal Installation.