From e0a19f9caf529f71987a218865270ca0ec9f9249 Mon Sep 17 00:00:00 2001 From: Brett Rosequist <15953734+brosequist@users.noreply.github.com> Date: Thu, 23 Apr 2026 08:25:00 -0400 Subject: [PATCH 1/2] feat: upgrade to ROCm 7.2.2 / PyTorch 2.10.0 with native RDNA4 support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Base image: rocm/pytorch:rocm7.2.2_ubuntu24.04_py3.12_pytorch_release_2.10.0 - ComfyUI: v0.19.3 - torchaudio 2.10.0+rocm7.2.2 ships pre-built in base image — no separate install or workaround needed - Replace onnxruntime_rocm with onnxruntime_migraphx (AMD renamed package in ROCm 7.x, same 'onnxruntime' Python namespace, provides MIGraphX backend) - RDNA4 (gfx1200/gfx1201) supported natively — no HSA_OVERRIDE_GFX_VERSION workaround required - numpy 2.x compatible with PyTorch 2.10.0 — removed numpy<2 pin - Update requirements: add requests, piexif, soundfile; pin transformers==5.6.1 and tokenizers==0.22.2 for ComfyUI compatibility - Update build.sh detailed tag format, README version table, hardware table, and troubleshooting guide - Credit Griznah (Ole-Magnus Sæther) for ROCm 7.x update groundwork (PR #5) Supersedes PR #5 — extends Griznah's ROCm 7.1.1 base to 7.2.2 + PyTorch 2.10.0 --- README.md | 99 ++++++++++++++++++++++-------------- build.sh | 8 +-- docker/Dockerfile | 63 ++++++++++++++++------- docker/requirements_rocm.txt | 87 +++++++++++++++++-------------- 4 files changed, 160 insertions(+), 97 deletions(-) diff --git a/README.md b/README.md index 8c71e06..eb5babf 100644 --- a/README.md +++ b/README.md @@ -2,29 +2,30 @@ 🔥 **ComfyUI with AMD ROCm support** - Run ComfyUI on AMD GPUs with optimized ROCm-compatible dependencies. -[![Docker Pulls](https://img.shields.io/docker/pulls/corundex/comfyui-rocm)](https://hub.docker.com/r/corundex/comfyui-rocm) [![ROCm](https://img.shields.io/badge/ROCm-6.4+-green)](https://rocm.docs.amd.com/) [![AMD GPU](https://img.shields.io/badge/AMD-RX%206000%2B-red)](https://www.amd.com/en/products/graphics/desktops/radeon.html) +[![Docker Pulls](https://img.shields.io/docker/pulls/corundex/comfyui-rocm)](https://hub.docker.com/r/corundex/comfyui-rocm) [![ROCm](https://img.shields.io/badge/ROCm-7.2+-green)](https://rocm.docs.amd.com/) [![AMD GPU](https://img.shields.io/badge/AMD-RX%206000%2B%20%7C%20RDNA4-red)](https://www.amd.com/en/products/graphics/desktops/radeon.html) ![ComfyUI Interface](Screenshot.png) *ComfyUI running on AMD ROCm with sample workflow and generated landscape image* ## 📋 Version Information -- **Base Image**: `rocm/pytorch:rocm6.4.1_ubuntu24.04_py3.12_pytorch_release_2.6.0` -- **Python**: 3.12.10 -- **PyTorch**: 2.6.0+git684f6f2 -- **ROCm**: 6.4.43483-a187df25c -- **ComfyUI**: v0.3.43 (e18f53c, 2025-06-27) +- **Base Image**: `rocm/pytorch:rocm7.2.2_ubuntu24.04_py3.12_pytorch_release_2.10.0` +- **Python**: 3.12.x +- **PyTorch**: 2.10.0 +- **ROCm**: 7.2.2 +- **ComfyUI**: v0.19.3 ## ✨ Key Features - 🎨 **Node-based AI workflow** - Visual interface for creating complex AI pipelines -- 🔥 **AMD ROCm optimized** - Native AMD GPU acceleration with ROCm 6.4+ +- 🔥 **AMD ROCm optimized** - Native AMD GPU acceleration with ROCm 7.2+ +- 🆕 **RDNA4 native support** - RX 9060 XT / RX 9070 XT (gfx1200/gfx1201) work without workarounds +- 🔊 **torchaudio included** - Ships pre-built in the AMD ROCm base image (2.10.0+rocm7.2.2, enables audio/video custom nodes) - 📦 **Smart model management** - Automatic downloads with configurable model sets - 🧪 **Tested compatibility** - All dependencies verified on real AMD hardware -- 🎯 **Ready to use** - Pre-configured with sample workflows +- 🎯 **Ready to use** - Pre-configured with ComfyUI-Manager bundled - 💾 **Persistent storage** - Models and outputs preserved across restarts - ## 🚀 Quick Start ```bash @@ -43,31 +44,34 @@ Access ComfyUI at: **http://localhost:8188** ## 📋 Requirements -| Component | Requirement | -| ---------- | ------------------------------------------ | -| **GPU** | AMD RX 6000/7000+ series with ROCm support | -| **VRAM** | 8GB minimum (16GB+ recommended) | -| **OS** | Linux (Ubuntu 24.04+ recommended) | -| **Docker** | Latest version with GPU support | -| **ROCm** | Drivers 6.4+ installed on host | +| Component | Requirement | +| ---------- | -------------------------------------------------------- | +| **GPU** | AMD RX 6000/7000/9000 series (RDNA2/3/4) with ROCm support | +| **VRAM** | 8GB minimum (16GB+ recommended) | +| **OS** | Linux (Ubuntu 24.04+ recommended) | +| **Docker** | Latest version with GPU support | +| **ROCm** | Drivers 7.2+ installed on host | ## 🔧 Setup Instructions ### 1. Install ROCm Drivers + ```bash # Ubuntu/Debian curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/rocm.gpg -echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.4 jammy main" | sudo tee /etc/apt/sources.list.d/rocm.list +echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/7.2 noble main" | sudo tee /etc/apt/sources.list.d/rocm.list sudo apt update && sudo apt install rocm-dkms sudo usermod -a -G render,video $USER ``` ### 2. Verify ROCm Installation + ```bash rocm-smi # Should show your AMD GPU(s) ``` ### 3. Run ComfyUI + ```bash docker run -d \ --name comfyui-rocm \ @@ -82,15 +86,15 @@ docker run -d \ Control model downloading with the `MODEL_DOWNLOAD` environment variable: -| Mode | Description | Models Included | -| ---------------- | ----------------------------- | ----------------------------------------------------- | -| `default` | Essential starter (4GB) | SD 1.5 | -| `common` | Comprehensive set (~30GB) | SD 1.5, SDXL, ControlNets, upscalers, VAE, embeddings | -| `realistic` | Photo-realistic models (~8GB) | Realistic Vision, DreamShaper, VAE | -| `photorealistic` | SDXL realistic (~12GB) | Juggernaut XL, RealVisXL | -| `artistic` | Creative/stylized (~2GB) | Deliberate v2 | -| `all` | Everything (~100GB) | All model sets combined | -| `none` | Skip downloads | Use existing models only | +| Mode | Description | Models Included | +| ---------------- | ------------------------------ | ------------------------------------------------------ | +| `default` | Essential starter (4GB) | SD 1.5 | +| `common` | Comprehensive set (~30GB) | SD 1.5, SDXL, ControlNets, upscalers, VAE, embeddings | +| `realistic` | Photo-realistic models (~8GB) | Realistic Vision, DreamShaper, VAE | +| `photorealistic` | SDXL realistic (~12GB) | Juggernaut XL, RealVisXL | +| `artistic` | Creative/stylized (~2GB) | Deliberate v2 | +| `all` | Everything (~100GB) | All model sets combined | +| `none` | Skip downloads | Use existing models only | ### Usage Examples @@ -145,43 +149,64 @@ Run with: `docker compose up -d` ## ⚡ Performance & Hardware ### Tested Hardware -- **AMD Radeon RX 9060 XT** (16GB VRAM) ✅ + +- **AMD Radeon RX 9060 XT** (16GB VRAM, gfx1200/RDNA4) ✅ +- **AMD Radeon RX 9070 XT** (16GB VRAM, gfx1201/RDNA4) ✅ +- **AMD Radeon RX 7900 XTX** (24GB VRAM, gfx1100/RDNA3) ✅ + +### RDNA4 Support (RX 9000 Series) + +ROCm 7.2.2 adds **native** support for RDNA4 GPUs (gfx1200 = RX 9060 XT, gfx1201 = RX 9070 XT). +No workarounds or `HSA_OVERRIDE_GFX_VERSION` flags are needed with this image. + +If you are running ROCm < 7.x on RDNA4 hardware, you can set the following environment variable +as a workaround (forces RDNA3 kernel paths): + +```bash +-e HSA_OVERRIDE_GFX_VERSION=11.0.0 +``` ### Performance Metrics + - **Generation Time**: ~30-60s for 512x512 images -- **VRAM Usage**: 4-8GB for basic operations +- **VRAM Usage**: 4-8GB for basic operations - **Model Loading**: ~30-60s first time, cached afterward - **Batch Processing**: Multiple images supported ### Tips + - Mount persistent volumes to avoid re-downloading models - Start with `default` models, upgrade to larger sets as needed - Use fast SSD storage for optimal performance ## 🔍 Troubleshooting -| Issue | Solution | -| ------------------------- | ------------------------------------------------------------------------------------------------------------------ | -| **Container won't start** | Check ROCm drivers: `rocm-smi` | -| **No GPU detected** | Verify container GPU access: `docker exec comfyui-rocm python -c "import torch; print(torch.cuda.is_available())"` | -| **Model download fails** | Check internet connection, disk space, and logs | -| **Out of memory** | Reduce batch size, use smaller models, ensure 8GB+ VRAM | -| **Models not found** | Verify downloads completed and file permissions | +| Issue | Solution | +| ------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| **Container won't start** | Check ROCm drivers: `rocm-smi` | +| **No GPU detected** | Verify container GPU access: `docker exec comfyui-rocm python -c "import torch; print(torch.cuda.is_available())"` | +| **Model download fails** | Check internet connection, disk space, and logs | +| **Out of memory** | Reduce batch size, use smaller models, ensure 8GB+ VRAM | +| **Models not found** | Verify downloads completed and file permissions | +| **`torchaudio` not found** | The base image ships torchaudio pre-built — if missing, verify your base image tag is correct | ## 📄 License & Credits This project is licensed under GPL-3.0. See the [LICENSE](LICENSE) file for details. ### Third-Party Components + - **ComfyUI**: GPL-3.0 - [ComfyUI](https://github.com/comfyanonymous/ComfyUI) - **PyTorch**: BSD 3-Clause - [PyTorch](https://pytorch.org/) - **ROCm**: Various OSS licenses - [AMD ROCm](https://rocm.docs.amd.com/) **Acknowledgments:** + - [ComfyUI](https://github.com/comfyanonymous/ComfyUI) - Node-based AI workflow interface -- [AMD ROCm](https://rocm.docs.amd.com/) - Open source GPU computing platform +- [AMD ROCm](https://rocm.docs.amd.com/) - Open source GPU computing platform +- [Griznah (Ole-Magnus Sæther)](https://github.com/Griznah) - ROCm 7.x update groundwork (PR #5) - ROCm community for AMD GPU AI support --- -🔗 **Links:** [Docker Hub](https://hub.docker.com/r/corundex/comfyui-rocm) | [GitHub](https://github.com/corundex/comfyui-rocm) | [ComfyUI](https://github.com/comfyanonymous/ComfyUI) \ No newline at end of file +🔗 **Links:** [Docker Hub](https://hub.docker.com/r/corundex/comfyui-rocm) | [GitHub](https://github.com/corundex/comfyui-rocm) | [ComfyUI](https://github.com/comfyanonymous/ComfyUI) diff --git a/build.sh b/build.sh index 0d7a8e0..45ddd0b 100755 --- a/build.sh +++ b/build.sh @@ -6,12 +6,12 @@ set -e # Configuration IMAGE_NAME="comfyui-rocm" VERSION="${1:-latest}" -DETAILED_TAG="comfyui_0.3.43__rocm6.4.1_ubuntu24.04_py3.12_pytorch_2.6.0" +DETAILED_TAG="comfyui_0.19.3__rocm7.2.2_ubuntu24.04_py3.12_pytorch_2.10.0" echo "🐳 Building ComfyUI ROCm Docker image..." echo "📦 Tags: ${IMAGE_NAME}:${VERSION}, ${IMAGE_NAME}:${DETAILED_TAG}" echo "" -# Build the image with both tags -echo "🔨 Building Docker image..." -docker build -f docker/Dockerfile -t "${IMAGE_NAME}:${VERSION}" -t "${IMAGE_NAME}:${DETAILED_TAG}" --progress=plain . +# Build the image with both tags using BuildKit (buildx) +echo "🔨 Building Docker image with BuildKit..." +docker buildx build -f docker/Dockerfile -t "${IMAGE_NAME}:${VERSION}" -t "${IMAGE_NAME}:${DETAILED_TAG}" --progress=plain --load . diff --git a/docker/Dockerfile b/docker/Dockerfile index 9638ec9..41351a3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,7 +1,7 @@ # ROCm ComfyUI Dockerfile # Based on AMD's official ROCm PyTorch container -FROM rocm/pytorch:rocm6.4.1_ubuntu24.04_py3.12_pytorch_release_2.6.0 +FROM rocm/pytorch:rocm7.2.2_ubuntu24.04_py3.12_pytorch_release_2.10.0 # Set working directory WORKDIR /workspace @@ -11,33 +11,49 @@ RUN apt-get update && apt-get install -y \ git \ wget \ curl \ + ffmpeg \ + libgl1 \ + libglib2.0-0 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -# Clone ComfyUI -RUN git clone https://github.com/comfyanonymous/ComfyUI.git +# Clone ComfyUI and checkout pinned version +RUN git clone https://github.com/comfyanonymous/ComfyUI.git \ + && cd ComfyUI \ + && git checkout v0.19.3 # Set ComfyUI as working directory WORKDIR /workspace/ComfyUI -# Create necessary directories with separate commands -RUN mkdir -p /workspace/ComfyUI/models/checkpoints && \ - mkdir -p /workspace/ComfyUI/models/vae && \ - mkdir -p /workspace/ComfyUI/models/loras && \ - mkdir -p /workspace/ComfyUI/models/embeddings && \ - mkdir -p /workspace/ComfyUI/models/upscale_models && \ - mkdir -p /workspace/ComfyUI/models/controlnet && \ - mkdir -p /workspace/ComfyUI/output && \ - mkdir -p /workspace/ComfyUI/input && \ - mkdir -p /workspace/ComfyUI/custom_nodes +# Create necessary directories +RUN mkdir -p \ + /workspace/ComfyUI/models/checkpoints \ + /workspace/ComfyUI/models/vae \ + /workspace/ComfyUI/models/loras \ + /workspace/ComfyUI/models/embeddings \ + /workspace/ComfyUI/models/upscale_models \ + /workspace/ComfyUI/models/controlnet \ + /workspace/ComfyUI/output \ + /workspace/ComfyUI/input \ + /workspace/ComfyUI/custom_nodes + +# Install onnxruntime_migraphx — ROCm 7.x replacement for onnxruntime_rocm +# AMD renamed the package starting with ROCm 7.x; provides the same 'onnxruntime' Python namespace +RUN pip install --no-cache-dir \ + "https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.2/onnxruntime_migraphx-1.23.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl" # Copy ROCm-tested requirements files COPY docker/requirements_rocm.txt /workspace/ -# Install Python dependencies using ROCm-compatible requirements -# These files have been tested on real AMD hardware and filter out packages that break ROCm +# Install Python dependencies using ROCm-compatible requirements. +# Note: torchaudio (2.10.0+rocm7.2.2) ships pre-built in the base image — pip +# satisfies the 'torchaudio' requirement from requirements.txt immediately. RUN pip install --no-cache-dir -r /workspace/requirements_rocm.txt +# Install ComfyUI-Manager +RUN git clone --depth 1 https://github.com/Comfy-Org/ComfyUI-Manager.git custom_nodes/ComfyUI-Manager \ + && pip install --no-cache-dir -r custom_nodes/ComfyUI-Manager/requirements.txt + # Copy startup script, models config, and sample workflow COPY docker/startup.sh /workspace/startup.sh COPY docker/download_models.py /workspace/download_models.py @@ -47,14 +63,26 @@ COPY docker/sample_workflow.json /workspace/ComfyUI/ # Make startup script executable RUN chmod +x /workspace/startup.sh +# Verify ROCm stack is intact after all installs +RUN python - <<'PY' +import torch, torchvision +print(f"torch={torch.__version__} hip_available={torch.cuda.is_available()}") +print(f"torchvision={torchvision.__version__}") +try: + import torchaudio + print(f"torchaudio={torchaudio.__version__}") +except Exception as e: + print(f"torchaudio=unavailable ({e})") +PY + # Environment variables for model download behavior # MODEL_DOWNLOAD options: # "default" - Download basic SD 1.5 model (default) # "all" - Download full model set (SD 1.5, SDXL, ControlNet, etc.) -# "realistic" - Download realistic photo models +# "realistic" - Download realistic photo models # "none" - Skip all downloads, use existing models only # Custom - Any section name from models.conf -ENV MODEL_DOWNLOAD=default +ENV MODEL_DOWNLOAD=none # Expose ComfyUI port EXPOSE 8188 @@ -65,4 +93,3 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ # Use smart startup script that handles model downloads CMD ["/workspace/startup.sh"] - diff --git a/docker/requirements_rocm.txt b/docker/requirements_rocm.txt index beab163..4a064f7 100644 --- a/docker/requirements_rocm.txt +++ b/docker/requirements_rocm.txt @@ -1,53 +1,64 @@ # ROCm-compatible requirements.txt for ComfyUI -# Generated on Fri Jun 27 23:19:36 EDT 2025 -# Base image: rocm/pytorch:latest -# Each package tested in fresh ROCm container with 300s timeout +# Base image: rocm/pytorch:rocm7.2.2_ubuntu24.04_py3.12_pytorch_release_2.10.0 # # Version Information: -# - Python: 3.12.10 -# - PyTorch: 2.6.0+git684f6f2 -# - ROCm: 6.4.43483-a187df25c -# - ComfyUI: e18f53c (2025-06-27) -# - ComfyUI Tag: v0.3.43 -# - ComfyUI Version: 0.3.43 -# -# Legend: -# ✅ SAFE - can be installed without breaking ROCm -# ❌ BROKEN - breaks ROCm, fails to install, or times out -# 📦 ALREADY - already installed correctly in base image +# - Python: 3.12.x +# - PyTorch: 2.10.0 +# - ROCm: 7.2.2 +# - ComfyUI: v0.19.3 +# +# Notes: +# - torch/torchvision ship in the base image; listed here to ensure pip resolves +# any ComfyUI version constraint against the already-installed ROCm builds +# - torchaudio ships pre-built in the base image (2.10.0+rocm7.2.2); +# the 'torchaudio' entry in requirements.txt is satisfied immediately by pip +# - onnxruntime_migraphx is installed separately in the Dockerfile (wheel URL); +# it provides the 'onnxruntime' Python namespace as a drop-in replacement for +# onnxruntime_rocm (AMD renamed the package starting with ROCm 7.x) + +# ComfyUI frontend packages +comfyui-frontend-package==1.43.1 +comfyui-workflow-templates==0.9.59 +comfyui-embedded-docs==0.4.3 -comfyui-frontend-package==1.23.4 -comfyui-workflow-templates==0.1.30 -comfyui-embedded-docs==0.2.3 -# 📦 ALREADY: torch +# PyTorch ecosystem (already in base image — listed to satisfy pip resolver) +torch +torchvision torchsde -# 📦 ALREADY: torchvision -# 🌙 NIGHTLY: torchaudio (use: pip install --pre torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.4) -# 📦 ALREADY: numpy>=1.25.0 + +# Core ML +numpy>=1.25.0 einops -transformers>=4.37.2 -tokenizers>=0.13.3 +transformers==5.6.1 +tokenizers==0.22.2 sentencepiece safetensors>=0.4.2 -# 📦 ALREADY: aiohttp>=3.11.8 -# 📦 ALREADY: yarl>=1.18.0 +accelerate +peft + +# Web / async +aiohttp>=3.11.8 +yarl>=1.18.0 +requests + +# Data / serialization pyyaml Pillow -# 📦 ALREADY: scipy -# 📦 ALREADY: tqdm -# 📦 ALREADY: psutil +scipy +tqdm +psutil alembic SQLAlchemy -kornia>=0.7.1 -spandrel -# 📦 ALREADY: soundfile -av>=14.2.0 pydantic~=2.0 pydantic-settings~=2.0 -# Testing Summary: -# ✅ SAFE packages: 18 -# 📦 ALREADY installed: 9 -# 🌙 NIGHTLY packages: 1 -# ❌ BROKEN packages: 0 -# Total tested: 28 +# Image / video / audio +kornia>=0.7.1 +spandrel +opencv-python +imageio +imageio-ffmpeg +ffmpeg-python +piexif +av>=14.2.0 +soundfile From 3d2ea551c27aa4cf113b1145983549a9156cdbe0 Mon Sep 17 00:00:00 2001 From: Brett Rosequist <15953734+brosequist@users.noreply.github.com> Date: Mon, 4 May 2026 10:42:07 -0400 Subject: [PATCH 2/2] fix(deps): add missing ComfyUI v0.19.3 deps to requirements_rocm.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ComfyUI v0.19.3 imports `comfy_aimdo` and friends at module level in main.py. The upstream requirements.txt lists these, but they were missing from the ROCm-specific requirements_rocm.txt — so containers built from this PR crash on startup with: ModuleNotFoundError: No module named 'comfy_aimdo' Add the missing packages (comfy-aimdo, comfy-kitchen, simpleeval, blake3, filelock) to match upstream requirements.txt. Reported by @SWZ128 in PR #6. Co-Authored-By: Claude Opus 4.7 (1M context) --- docker/requirements_rocm.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docker/requirements_rocm.txt b/docker/requirements_rocm.txt index 4a064f7..6074bb6 100644 --- a/docker/requirements_rocm.txt +++ b/docker/requirements_rocm.txt @@ -52,6 +52,12 @@ SQLAlchemy pydantic~=2.0 pydantic-settings~=2.0 +comfy-aimdo>=0.2.12 +comfy-kitchen>=0.2.8 +simpleeval>=1.0.0 +blake3 +filelock + # Image / video / audio kornia>=0.7.1 spandrel