Install ComfyUI and MIGraphX extension#

Install ComfyUI and the MIGraphX extension on AMD GPUs.

Prerequisites#

  • ROCm is installed.

Installation#

Follow these steps to install ComfyUI.

  1. Create a Python virtual environment.

    python3 -m venv venv --system-site-packages
    source venv/bin/activate
    
  2. Install PyTorch (ROCm) wheels in a virtual environment.

    Install the latest PyTorch ROCm wheels in the environment created.

    Note

    See Install PyTorch for Radeon GPUs for install instructions.

  3. Clone the ComfyUI repository.

    git clone https://github.com/comfyanonymous/ComfyUI.git
    

    Note

    See ComfyUI Github for more information.

  4. Modify requirements.txt.

    To avoid conflicts with ROCm’s PyTorch packages, comment out the following packages in requirements.txt.

    • torch

    • torchaudio

    • torchvision

    cd ComfyUI
    sudo nano requirements.txt
    

    Post-edit example

    comfyui-frontend-package==1.19.9
    comfyui-workflow-templates==0.1.14
    #torch
    torchsde
    #torchvision
    #torchaudio
    numpy>=1.25.0
    einops
    transformers>=4.28.1
    tokenizers>=0.13.3
    sentencepiece
    safetensors>=0.4.2
    aiohttp>=3.11.8
    yarl>=1.18.0
    pyyaml
    Pillow
    scipy
    tqdm
    psutil
    #non essential dependencies:
    kornia>=0.7.1
    spandrel
    soundfile
    av>=14.2.0
    pydantic~=2.0
    
  5. Install ComfyUI requirements.

    pip install -r requirements.txt
    
  6. Load Stable Diffusion 3 model.

    Load a Stable Diffusion 3 model into the following directory:

    cd ComfyUI/models/checkpoints
    

    Note

    As an example, the sd3_medium_incl_clips.safetensors model can be added into this directory.

  7. Launch ComfyUI.

    Note

    Users must return to the home directory of the repository in order to run main.py.

    python3 main.py
    

Installing the MIGraphX node for ComfyUI#

The MIGraphX Node for ComfyUI offers accelerated inference on Stable Diffusion 3 models.

Note

Refer to ComfyUI MIGraphX Github for more information.

  1. Install the MIGraphX node.

    cd ComfyUI/custom_nodes
    git clone https://github.com/pnikolic-amd/ComfyUI_MIGraphX.git
    cd ComfyUI_MIGraphX
    pip install -r requirements.txt
    
  2. Launch ComfyUI.

    Note

    The ROCm path to Python must be exported to prevent a module missing error for MIGraphX.

    export PYTHONPATH=/opt/rocm-X.X.X/lib:$PYTHONPATH
    

    Replace the ROCm version with your applicable version. For example, /opt/rocm-6.4.1/lib.

    cd ComfyUI
    # For the best performance, run the following environment variable:
    export MIGRAPHX_MLIR_USE_SPECIFIC_OPS="attention"
    python3 main.py
    

Using the MIGraphX node for ComfyUI#

The MIGraphX Node for ComfyUI includes ready-to-use templates, each preconfigured with optimized settings for the supported Stable Diffusion models.

  • To access them, go to: Workflow > Browse Templates > ComfyUI_MIGraphX

  • Each template is optimized for a specific Stable Diffusion model. Be sure to load the corresponding model before using the template.

Example usage#

Note

The initial run takes some time to allow MIGraphX to warm up and tune the model.

If the recommended sd3_medium_incl_clips.safetensors is loaded, the SD3M_example_PYTORCH template can be selected.

PyTorch template