Changing comfyui creation

This commit is contained in:
John Doe
2025-11-23 15:54:52 -05:00
parent 9f0982c9fc
commit 4152fa7884
7 changed files with 78 additions and 245 deletions

View File

@@ -7,15 +7,6 @@ RUN apt-get update \
# Copy ComfyUI repository and pre-built virtual environment
WORKDIR /app
COPY ComfyUI /app/ComfyUI
# Copy the appropriate virtual environment based on GPU architecture
# The venv should be created by running create-venv.sh on the host
ARG GPU_ARCH="rocm7.1"
COPY ${GPU_ARCH} /app/ComfyUI/venv
# Set working directory to ComfyUI
WORKDIR /app/ComfyUI
# Set environment to use the virtual environment and add ROCm runtime settings
ENV PATH="/app/ComfyUI/venv/bin:$PATH" \
@@ -26,5 +17,8 @@ ENV PATH="/app/ComfyUI/venv/bin:$PATH" \
# Expose default ComfyUI port
EXPOSE 8188
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
# Set the default command to run ComfyUI with ROCm optimizations
CMD ["python", "main.py", "--listen", "0.0.0.0", "--port", "8188", "--force-fp16"]
ENTRYPOINT ["/docker-entrypoint.sh"]

View File

@@ -99,19 +99,6 @@ echo ""
cd comfyui-build
print_step "Creating/updating virtual environment..."
echo -e "${YELLOW}Command: bash ./create-venv.sh${NC}"
if bash ./create-venv.sh; then
print_success "Virtual environment created/updated successfully"
else
print_error "Failed to create/update virtual environment"
exit 1
fi
echo ""
echo -e "${BLUE}----------------------------------------${NC}"
echo ""
print_step "Building ComfyUI variants for different GPU architectures..."
echo -e "${YELLOW}Command: bash ./build-comfyui-variants.sh${NC}"
if bash ./build-comfyui-variants.sh; then

View File

@@ -1,62 +0,0 @@
#!/bin/bash
# Build script for ComfyUI with different AMD GPU architecture support
REGISTRY="docker.io/getterup"
Dockerfiles_DIR="../Dockerfiles"
echo "Building ComfyUI docker images for different AMD GPU architectures..."
# ROCm 7.1 (General compatibility)
echo "Building ComfyUI with ROCm 7.1 (General)..."
podman build -t ${REGISTRY}/comfyui:rocm7.1 \
--build-arg GPU_ARCH="rocm7.1" \
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
# RDNA 3 (RX 7000 series)
echo "Building ComfyUI for RDNA 3 (RX 7000 series)..."
podman build -t ${REGISTRY}/comfyui:rdna3-gfx110x \
--build-arg GPU_ARCH="gfx110X" \
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
# RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)
echo "Building ComfyUI for RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)..."
podman build -t ${REGISTRY}/comfyui:rdna3.5-gfx1151 \
--build-arg GPU_ARCH="gfx1151" \
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
# RDNA 4 (RX 9000 series)
echo "Building ComfyUI for RDNA 4 (RX 9000 series)..."
podman build -t ${REGISTRY}/comfyui:rdna4-gfx120x \
--build-arg GPU_ARCH="gfx120X" \
-f ${Dockerfiles_DIR}/Dockerfile.comfyui-rocm7.1 .
echo "All ComfyUI builds completed!"
echo ""
echo "Pushing images to registry..."
# Push all images to registry
echo "Pushing ${REGISTRY}/comfyui:rocm7.1..."
podman push ${REGISTRY}/comfyui:rocm7.1
echo "Pushing ${REGISTRY}/comfyui:rdna3-gfx110x..."
podman push ${REGISTRY}/comfyui:rdna3-gfx110x
echo "Pushing ${REGISTRY}/comfyui:rdna3.5-gfx1151..."
podman push ${REGISTRY}/comfyui:rdna3.5-gfx1151
echo "Pushing ${REGISTRY}/comfyui:rdna4-gfx120x..."
podman push ${REGISTRY}/comfyui:rdna4-gfx120x
echo ""
echo "All images pushed to registry!"
echo ""
echo "Available images at ${REGISTRY}:"
echo " - ${REGISTRY}/comfyui:rocm7.1 (General ROCm 7.1)"
echo " - ${REGISTRY}/comfyui:rdna3-gfx110x (RDNA 3 - RX 7000 series)"
echo " - ${REGISTRY}/comfyui:rdna3.5-gfx1151 (RDNA 3.5 - Strix halo/Ryzen AI Max+ 365)"
echo " - ${REGISTRY}/comfyui:rdna4-gfx120x (RDNA 4 - RX 9000 series)"
echo ""
echo "Run with: docker run --rm --device=/dev/kfd --device=/dev/dri -p 8188:8188 ${REGISTRY}/comfyui:<tag>"

View File

@@ -1,157 +0,0 @@
#!/bin/bash
# ComfyUI Virtual Environment Creation Script for AMD GPUs
# This script clones ComfyUI and creates 4 different virtual environments
# optimized for different AMD GPU architectures
set -e
echo "=== ComfyUI Multi-Architecture Build Script ==="
echo "Creating optimized builds for different AMD GPU architectures..."
# Clone ComfyUI if it doesn't exist
if [ ! -d "ComfyUI" ]; then
echo "Cloning ComfyUI repository..."
git clone https://github.com/comfyanonymous/ComfyUI.git
else
echo "ComfyUI directory already exists, skipping clone..."
fi
cd ComfyUI
# Update ComfyUI repository
echo "Updating ComfyUI repository..."
git pull
cd ..
echo "Building ComfyUI with ROCm 7.1 (General)..."
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/nightly/rocm7.1"
GPU_ARCH="rocm7.1"
python3 -m venv rocm7.1
. rocm7.1/bin/activate
pip install --upgrade pip
if echo "${PYTORCH_INDEX_URL}" | grep -q "rocm.nightlies.amd.com"; then
pip install --pre torch torchvision torchaudio --extra-index-url ${PYTORCH_INDEX_URL}
else
pip install --pre torch torchvision torchaudio --index-url ${PYTORCH_INDEX_URL}
fi
pip install -r ComfyUI/requirements.txt
pip install opencv-python gguf
deactivate
# RDNA 3 (RX 7000 series)
echo "Building ComfyUI for RDNA 3 (RX 7000 series)..."
GPU_ARCH="gfx110X"
python3 -m venv gfx110X
. gfx110X/bin/activate
pip install --upgrade pip
# Try stable ROCm 7.1 first, fallback to nightly if needed
echo "Attempting to install PyTorch with ROCm 7.1 stable..."
if pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm7.1; then
echo "Successfully installed PyTorch with stable ROCm 7.1"
else
echo "Failed with stable build, trying ROCm 6.2 as fallback..."
if pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2; then
echo "Successfully installed PyTorch with ROCm 6.2"
else
echo "Failed to install PyTorch for gfx110X. Skipping this environment."
deactivate
rm -rf gfx110X
echo "Skipping gfx110X environment due to installation failure."
fi
fi
# Install remaining dependencies if PyTorch was installed
if [ -d "gfx110X" ]; then
if pip install -r ComfyUI/requirements.txt && pip install opencv-python gguf; then
echo "Successfully installed ComfyUI dependencies for gfx110X"
else
echo "Failed to install ComfyUI dependencies for gfx110X"
deactivate
rm -rf gfx110X
echo "Removed gfx110X environment due to dependency installation failure."
fi
deactivate
fi
# RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)
echo "Building ComfyUI for RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)..."
GPU_ARCH="gfx1151"
python3 -m venv gfx1151
. gfx1151/bin/activate
pip install --upgrade pip
# Try stable ROCm 7.1 first, fallback to nightly if needed
echo "Attempting to install PyTorch with ROCm 7.1 stable..."
if pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm7.1; then
echo "Successfully installed PyTorch with stable ROCm 7.1"
else
echo "Failed with stable build, trying ROCm 6.2 as fallback..."
if pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2; then
echo "Successfully installed PyTorch with ROCm 6.2"
else
echo "Failed to install PyTorch for gfx1151. Skipping this environment."
deactivate
rm -rf gfx1151
echo "Skipping gfx1151 environment due to installation failure."
fi
fi
# Install remaining dependencies if PyTorch was installed
if [ -d "gfx1151" ]; then
if pip install -r ComfyUI/requirements.txt && pip install opencv-python gguf; then
echo "Successfully installed ComfyUI dependencies for gfx1151"
else
echo "Failed to install ComfyUI dependencies for gfx1151"
deactivate
rm -rf gfx1151
echo "Removed gfx1151 environment due to dependency installation failure."
fi
deactivate
fi
# RDNA 4 (RX 9000 series)
echo "Building ComfyUI for RDNA 4 (RX 9000 series)..."
GPU_ARCH="gfx120X"
python3 -m venv gfx120X
. gfx120X/bin/activate
pip install --upgrade pip
# Try stable ROCm 7.1 first, fallback to nightly if needed
echo "Attempting to install PyTorch with ROCm 7.1 stable..."
if pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm7.1; then
echo "Successfully installed PyTorch with stable ROCm 7.1"
else
echo "Failed with stable build, trying ROCm 6.2 as fallback..."
if pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2; then
echo "Successfully installed PyTorch with ROCm 6.2"
else
echo "Failed to install PyTorch for gfx120X. Skipping this environment."
deactivate
rm -rf gfx120X
echo "Skipping gfx120X environment due to installation failure."
fi
fi
# Install remaining dependencies if PyTorch was installed
if [ -d "gfx120X" ]; then
if pip install -r ComfyUI/requirements.txt && pip install opencv-python gguf; then
echo "Successfully installed ComfyUI dependencies for gfx120X"
else
echo "Failed to install ComfyUI dependencies for gfx120X"
deactivate
rm -rf gfx120X
echo "Removed gfx120X environment due to dependency installation failure."
fi
deactivate
fi
echo "Virtual environment creation completed!"
echo "Successfully created environments:"
if [ -d "rocm7.1" ]; then echo " ✅ rocm7.1 (General ROCm 7.1)"; else echo " ❌ rocm7.1 (Failed)"; fi
if [ -d "gfx110X" ]; then echo " ✅ gfx110X (RDNA 3 - RX 7000 series)"; else echo " ❌ gfx110X (Failed)"; fi
if [ -d "gfx1151" ]; then echo " ✅ gfx1151 (RDNA 3.5 - Strix halo/Ryzen AI Max+ 365)"; else echo " ❌ gfx1151 (Failed)"; fi
if [ -d "gfx120X" ]; then echo " ✅ gfx120X (RDNA 4 - RX 9000 series)"; else echo " ❌ gfx120X (Failed)"; fi

View File

@@ -0,0 +1,68 @@
#!/bin/bash
# ComfyUI Virtual Environment Creation Script for AMD GPUs
# This script clones ComfyUI and creates 4 different virtual environments
# optimized for different AMD GPU architectures
# Read GPU_ARCH environment variable if set
if [ -n "$GPU_ARCH" ]; then
echo "GPU_ARCH environment variable detected: $GPU_ARCH"
echo "Will prioritize build for architecture: $GPU_ARCH"
else
echo "No GPU_ARCH environment variable set, building all architectures..."
fi
cd /app
set -e
echo "=== ComfyUI Multi-Architecture Build Script ==="
echo "Creating optimized builds for different AMD GPU architectures..."
# Clone ComfyUI if it doesn't exist
if [ ! -d "ComfyUI" ]; then
echo "Cloning ComfyUI repository..."
git clone https://github.com/comfyanonymous/ComfyUI.git
else
echo "ComfyUI directory already exists, skipping clone..."
fi
cd ComfyUI
# Update ComfyUI repository
echo "Updating ComfyUI repository..."
git pull
# Set PyTorch index URL based on GPU_ARCH if specified
if [ "$GPU_ARCH" = "rocm7.1" ]; then
echo "Building ComfyUI with ROCm 7.1 (General)..."
PYTORCH_INDEX_URL="https://download.pytorch.org/whl/nightly/rocm7.1"
fi
if [ "$GPU_ARCH" = "gfx110X" ]; then
echo "Building ComfyUI with ROCm 7.1 RDNA 3 (RX 7000 series)..."
PYTORCH_INDEX_URL="https://rocm.nightlies.amd.com/v2/gfx110X-dgpu/"
fi
if [ "$GPU_ARCH" = "gfx1151" ]; then
echo "Building ComfyUI with ROCm 7.1 RDNA 3.5 (Strix halo/Ryzen AI Max+ 365)..."
PYTORCH_INDEX_URL="https://rocm.nightlies.amd.com/v2/gfx1151/"
fi
if [ "$GPU_ARCH" = "gfx120X" ]; then
echo "Building ComfyUI with ROCm 7.1 RDNA 4 (RX 9000 series)..."
PYTORCH_INDEX_URL="https://rocm.nightlies.amd.com/v2/gfx120X-all/"
fi
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
if echo "${PYTORCH_INDEX_URL}" | grep -q "rocm.nightlies.amd.com"; then
pip install --pre torch torchvision torchaudio --extra-index-url ${PYTORCH_INDEX_URL}
else
pip install --pre torch torchvision torchaudio --index-url ${PYTORCH_INDEX_URL}
fi
pip install -r ComfyUI/requirements.txt
python main.py --listen 0.0.0.0 --port 8188 --force-fp16

View File

@@ -96,12 +96,17 @@ services:
comfyui:
image: getterup/comfyui:rocm7.1
container_name: comfyui
environment:
- HIP_VISIBLE_DEVICES=1
- COMFYUI_ENABLE_ROCM=True
- GPU_ARCH="rocm7.1"
ports:
- "8188:8188"
networks:
rocm-network:
ipv4_address: 172.28.0.5
volumes:
- ./User-Directories/ComfyUI/venv/audio_encoders:/app/ComfyUI/venv
- ./User-Directories/ComfyUI/models/audio_encoders:/app/ComfyUI/models/audio_encoders
- ./User-Directories/ComfyUI/models/checkpoints:/app/ComfyUI/models/checkpoints
- ./User-Directories/ComfyUI/models/clip:/app/ComfyUI/models/clip
@@ -132,9 +137,6 @@ services:
- /dev/dri:/dev/dri
group_add:
- video
environment:
- HIP_VISIBLE_DEVICES=1
- COMFYUI_ENABLE_ROCM=True
restart: unless-stopped
security_opt:
- seccomp=unconfined

View File

@@ -80,6 +80,7 @@ BASE_DIR="./ComfyUI"
# Create model directories
echo "🤖 Creating ComfyUI model directories..."
mkdir -p "${BASE_DIR}/venv"
mkdir -p "${BASE_DIR}/models/audio_encoders"
mkdir -p "${BASE_DIR}/models/checkpoints"
mkdir -p "${BASE_DIR}/models/clip"