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. Install the Python venv package for the applicable Python version.

    sudo apt install python3.12-venv
    
    sudo apt install python3.10-venv
    
  2. Create a Python virtual environment.

    python3 -m venv comfyui-venv
    source comfyui-venv/bin/activate
    
  3. Install the latest PyTorch ROCm wheels in the environment created.

    Note
    Refer to Install Pytorch for Radeon GPUs for more comprehensive install instructions. Proceed to install within the environment if the wheels are already downloaded to the system. Example command:

    pip3 install <torch wheel> <torchaudio wheel> <torchvision wheel> <triton wheel>
    
  4. Clone the ComfyUI repository.

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

    Note

    See ComfyUI Github for more information.

  5. Install ComfyUI requirements.

    pip install -r requirements.txt
    
  6. Launch ComfyUI.

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

    python3 main.py
    

    Click to URL to open ComfyUI in a browser.

    Note
    After running the above command, ensure that the Pytorch version seen in the terminal is the ROCm 7.1.1 specific one.

  7. From the ComfyUI frontend, click on Templates → Search for ‘SDXL Turbo’ → Follow prompt for model install and place it into the ‘checkpoints’ folder under ComfyUI>models>checkpoints.

    PyTorch template

  8. From the ComfyUI frontend, click ‘Run’ to begin image generation. PyTorch template

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.