mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-14 23:42:35 +08:00
Configure RunPod network storage for models
- Remove model downloads from Dockerfile - Add symlink to /runpod-volume/models - Add extra_model_paths.yaml for network storage - Improve error handling in handler - Models will be loaded from RunPod network storage
This commit is contained in:
parent
4f5fd5b888
commit
91494226db
@ -47,19 +47,17 @@ RUN pip install --no-cache-dir \
|
|||||||
# Install ComfyUI requirements if exists
|
# Install ComfyUI requirements if exists
|
||||||
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi
|
||||||
|
|
||||||
# Create necessary directories
|
# Create necessary directories for temp files
|
||||||
RUN mkdir -p /workspace/ComfyUI/models/checkpoints \
|
RUN mkdir -p /workspace/ComfyUI/input \
|
||||||
/workspace/ComfyUI/models/vae \
|
|
||||||
/workspace/ComfyUI/models/loras \
|
|
||||||
/workspace/ComfyUI/models/controlnet \
|
|
||||||
/workspace/ComfyUI/models/clip_vision \
|
|
||||||
/workspace/ComfyUI/models/upscale_models \
|
|
||||||
/workspace/ComfyUI/input \
|
|
||||||
/workspace/ComfyUI/output \
|
/workspace/ComfyUI/output \
|
||||||
/tmp/inputs \
|
/tmp/inputs \
|
||||||
/tmp/outputs \
|
/tmp/outputs \
|
||||||
/tmp/comfyui
|
/tmp/comfyui
|
||||||
|
|
||||||
|
# Create symlinks to network storage for models
|
||||||
|
RUN mkdir -p /runpod-volume && \
|
||||||
|
ln -sf /runpod-volume/models /workspace/ComfyUI/models
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV PYTHONPATH="/workspace/ComfyUI:${PYTHONPATH}"
|
ENV PYTHONPATH="/workspace/ComfyUI:${PYTHONPATH}"
|
||||||
ENV COMFYUI_SERVERLESS=true
|
ENV COMFYUI_SERVERLESS=true
|
||||||
|
|||||||
@ -39,14 +39,33 @@ class ComfyUIServerlessHandler:
|
|||||||
"""Start ComfyUI server in background"""
|
"""Start ComfyUI server in background"""
|
||||||
try:
|
try:
|
||||||
logger.info("Starting ComfyUI server...")
|
logger.info("Starting ComfyUI server...")
|
||||||
|
|
||||||
|
# Check if main.py exists
|
||||||
|
if not os.path.exists("/workspace/ComfyUI/main.py"):
|
||||||
|
logger.error("main.py not found in /workspace/ComfyUI")
|
||||||
|
raise FileNotFoundError("ComfyUI main.py not found")
|
||||||
|
|
||||||
|
# Check if models directory exists (network storage)
|
||||||
|
if not os.path.exists("/workspace/ComfyUI/models"):
|
||||||
|
logger.warning("Models directory not found, creating symlink to network storage")
|
||||||
|
if os.path.exists("/runpod-volume/models"):
|
||||||
|
os.symlink("/runpod-volume/models", "/workspace/ComfyUI/models")
|
||||||
|
else:
|
||||||
|
logger.error("Network storage models not found at /runpod-volume/models")
|
||||||
|
|
||||||
|
# Start ComfyUI
|
||||||
self.comfyui_process = subprocess.Popen([
|
self.comfyui_process = subprocess.Popen([
|
||||||
"python3", "main.py",
|
"python3", "main.py",
|
||||||
"--listen", "0.0.0.0",
|
"--listen", "0.0.0.0",
|
||||||
"--port", "8000",
|
"--port", "8000",
|
||||||
"--dont-print-server",
|
"--dont-print-server",
|
||||||
"--disable-auto-launch"
|
"--disable-auto-launch"
|
||||||
], cwd="/workspace/ComfyUI")
|
], cwd="/workspace/ComfyUI",
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
|
||||||
logger.info("ComfyUI server started")
|
logger.info("ComfyUI server started")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to start ComfyUI: {str(e)}")
|
logger.error(f"Failed to start ComfyUI: {str(e)}")
|
||||||
raise
|
raise
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user