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
    

    Note

    See ComfyUI Github for more information.

  5. Install ComfyUI requirements.

    pip install -r requirements.txt
    
  6. Load Stable Diffusion 3 model into the following folder.

    cd ComfyUI/models/checkpoints
    

    Note

    As an example, the sd3_medium_incl_clips.safetensors model can be added into this directory.
    This version already includes the clips, so only this download is needed. You may need to sign in and request access to the model

  7. Launch ComfyUI.

    Note

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

    python3 main.py
    

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

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