File size: 8,140 Bytes
af89b7a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | #!/bin/bash
# ============================================================
# USER CONFIGURATION
# ============================================================
# 1. Paste your Civitai API Key here (get it from:
# https://civitai.com/user/account -> API Keys)
# 2. Leave COMFYUI_BASE_DIR as "" to auto-detect, or set it
# manually (e.g., "/workspace/ComfyUI").
# ============================================================
CIVITAI_API_KEY="YOUR_API_KEY_HERE" # <-- PASTE YOUR KEY HERE
COMFYUI_BASE_DIR="" # Leave empty for auto-detect
# ============================================================
# Exit on critical errors, but allow individual downloads to fail
set -e
# ----------------------------------------------
# 1. Utility Functions
# ----------------------------------------------
print_status() {
echo ">>> $1"
}
check_dependencies() {
local needs_update=0
if ! command -v wget &> /dev/null; then
print_status "wget not found. Installing..."
needs_update=1
apt-get install -y wget || { print_status "Failed to install wget. Exiting."; exit 1; }
fi
if ! command -v git &> /dev/null; then
print_status "git not found. Installing..."
needs_update=1
apt-get install -y git || { print_status "Failed to install git. Exiting."; exit 1; }
fi
if [ $needs_update -eq 1 ]; then
apt-get update -qq
fi
}
find_comfyui() {
if [ -n "$COMFYUI_BASE_DIR" ] && [ -d "$COMFYUI_BASE_DIR" ]; then
echo "$COMFYUI_BASE_DIR"
return 0
fi
print_status "Auto-detecting ComfyUI installation..."
local detected
detected=$(find / -type d -name "ComfyUI" 2>/dev/null | grep -E "workspace|app|root" | head -1)
if [ -z "$detected" ]; then
print_status "ERROR: Could not find ComfyUI."
print_status "Please set COMFYUI_BASE_DIR manually in the script."
exit 1
fi
echo "$detected"
}
download_file() {
local url="$1"
local output="$2"
local cmd=(wget -c --tries=3 --timeout=30 --header="Referer: https://civitai.com")
# Add Civitai authentication if the URL is from Civitai and we have a key
if [[ "$url" == *"civitai"* ]] && [ -n "$CIVITAI_API_KEY" ] && [ "$CIVITAI_API_KEY" != "YOUR_API_KEY_HERE" ]; then
cmd+=(--header="Authorization: Bearer $CIVITAI_API_KEY")
fi
cmd+=(-O "$output" "$url")
print_status "Downloading: $(basename "$output")"
"${cmd[@]}" || print_status "WARNING: Failed to download $(basename "$output") (skipping)"
}
# ----------------------------------------------
# 2. Setup Directories & Dependencies
# ----------------------------------------------
print_status "Checking system dependencies..."
check_dependencies
BASE_DIR=$(find_comfyui)
print_status "Using ComfyUI at: $BASE_DIR"
CUSTOM_NODES_DIR="$BASE_DIR/custom_nodes"
DIFFUSION_MODELS_DIR="$BASE_DIR/models/diffusion_models"
UNET_DIR="$BASE_DIR/models/unet"
TEXT_ENCODERS_DIR="$BASE_DIR/models/text_encoders"
VAE_DIR="$BASE_DIR/models/vae"
CONTROLNET_DIR="$BASE_DIR/models/controlnet"
WORKFLOWS_DIR="$BASE_DIR/user/default/workflows"
mkdir -p "$CUSTOM_NODES_DIR" "$DIFFUSION_MODELS_DIR" "$UNET_DIR" \
"$TEXT_ENCODERS_DIR" "$VAE_DIR" "$CONTROLNET_DIR" "$WORKFLOWS_DIR"
# ----------------------------------------------
# 3. Install Custom Nodes (Extensions)
# ----------------------------------------------
print_status "Cloning custom nodes..."
git clone --depth 1 https://gitlab.com/UmeAiRT-Studio/comfyui-umeairt-toolkit.git "$CUSTOM_NODES_DIR/comfyui-umeairt-toolkit" || print_status "WARNING: comfyui-umeairt-toolkit clone failed"
git clone --depth 1 https://github.com/Mirumo0u0/ComfyUI-Cosmos-Reference.git "$CUSTOM_NODES_DIR/ComfyUI-Cosmos-Reference" || print_status "WARNING: ComfyUI-Cosmos-Reference clone failed"
git clone --depth 1 https://github.com/kohya-ss/ComfyUI-Anima-LLLite.git "$CUSTOM_NODES_DIR/ComfyUI-Anima-LLLite" || print_status "WARNING: ComfyUI-Anima-LLLite clone failed"
git clone --depth 1 https://github.com/scraed/LanPaint.git "$CUSTOM_NODES_DIR/LanPaint" || print_status "WARNING: LanPaint clone failed"
# ----------------------------------------------
# 4. Download Models
# ----------------------------------------------
print_status "Downloading Diffusion Models (Hugging Face + Civitai)..."
download_file "https://huggingface.co/circlestone-labs/Anima/resolve/main/split_files/diffusion_models/anima-base-v1.0.safetensors" "$DIFFUSION_MODELS_DIR/anima-base-v1.0.safetensors"
download_file "https://huggingface.co/circlestone-labs/Anima/resolve/main/split_files/diffusion_models/anima-turbo-v1.0.safetensors" "$DIFFUSION_MODELS_DIR/anima-turbo-v1.0.safetensors"
download_file "https://civitai.red/api/download/models/3089149?fileId=2968664" "$DIFFUSION_MODELS_DIR/anima_civitai_3089149.safetensors"
download_file "https://civitai.red/api/download/models/2978373?fileId=2857988" "$DIFFUSION_MODELS_DIR/anima_civitai_2978373.safetensors"
download_file "https://civitai.red/api/download/models/3036905?fileId=2915794" "$DIFFUSION_MODELS_DIR/anima_civitai_3036905.safetensors"
print_status "Downloading GGUF version..."
download_file "https://huggingface.co/UmeAiRT/ComfyUI-Auto-Installer-Assets/resolve/main/models/diffusion_models/Anima/anima-base-v1.0-Q8_0.gguf?download=true" "$UNET_DIR/anima-base-v1.0-Q8_0.gguf"
print_status "Downloading Text Encoder..."
download_file "https://huggingface.co/UmeAiRT/ComfyUI-Auto-Installer-Assets/resolve/main/models/text_encoders/QWEN/qwen_3_06b_base.safetensors" "$TEXT_ENCODERS_DIR/qwen_3_06b_base.safetensors"
print_status "Downloading VAE..."
download_file "https://huggingface.co/UmeAiRT/ComfyUI-Auto-Installer-Assets/resolve/main/models/vae/qwen_image_vae.safetensors" "$VAE_DIR/qwen_image_vae.safetensors"
# ----------------------------------------------
# 5. Download ControlNets / LLLite
# ----------------------------------------------
print_status "Downloading ControlNet / LLLite models..."
if [ ! -d "$CONTROLNET_DIR/Anima-LLLite" ]; then
git clone --depth 1 https://huggingface.co/kohya-ss/Anima-LLLite "$CONTROLNET_DIR/Anima-LLLite" || print_status "WARNING: Anima-LLLite repo clone failed"
fi
download_file "https://civitai.red/api/download/models/3068951?fileId=2947687" "$CONTROLNET_DIR/controlnet_3068951.safetensors"
download_file "https://civitai.red/api/download/models/3026450?fileId=2905226" "$CONTROLNET_DIR/controlnet_3026450.safetensors"
# ----------------------------------------------
# 6. Download Workflows
# ----------------------------------------------
print_status "Downloading Workflows..."
download_file "https://civitai.red/api/download/models/3012166?fileId=2891167" "$WORKFLOWS_DIR/workflow_3012166.json"
download_file "https://civitai.red/api/download/models/3015408?fileId=2894362" "$WORKFLOWS_DIR/workflow_3015408.json"
download_file "https://civitai.red/api/download/models/3032221?fileId=2911092" "$WORKFLOWS_DIR/workflow_3032221.json"
download_file "https://civitai.red/api/download/models/3032360?fileId=2911253" "$WORKFLOWS_DIR/workflow_3032360.json"
download_file "https://civitai.red/api/download/models/3102845?fileId=2982677" "$WORKFLOWS_DIR/workflow_3102845.json"
download_file "https://civitai.red/api/download/models/2958554?fileId=2837926" "$WORKFLOWS_DIR/workflow_2958554.json"
download_file "https://civitai.red/api/download/models/2979081?fileId=2858654" "$WORKFLOWS_DIR/workflow_2979081.json"
# ----------------------------------------------
# 7. Done
# ----------------------------------------------
echo "=========================================="
echo "ALL DOWNLOADS COMPLETE!"
echo "ComfyUI location: $BASE_DIR"
echo ""
echo "Next steps:"
echo "1. Press 'R' in the ComfyUI web interface to reload models."
echo "2. Restart ComfyUI to load the new custom nodes."
echo " (Stop it with Ctrl+C, then run: python main.py --listen 0.0.0.0 --port 8188)"
echo "==========================================" |