Create build.sh
Browse files
build.sh
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
echo "=========================================="
|
| 5 |
+
echo "ποΈ BUILD PHASE: Installing Dependencies"
|
| 6 |
+
echo "=========================================="
|
| 7 |
+
echo ""
|
| 8 |
+
|
| 9 |
+
# Step 1: System dependencies
|
| 10 |
+
echo "[1/5] Installing system packages..."
|
| 11 |
+
apt-get update > /dev/null 2>&1
|
| 12 |
+
apt-get install -y git wget curl build-essential cmake > /dev/null 2>&1
|
| 13 |
+
echo "β System deps installed"
|
| 14 |
+
|
| 15 |
+
# Step 2: Clone ComfyUI
|
| 16 |
+
echo ""
|
| 17 |
+
echo "[2/5] Cloning ComfyUI..."
|
| 18 |
+
if [ ! -d "ComfyUI" ]; then
|
| 19 |
+
git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git
|
| 20 |
+
fi
|
| 21 |
+
cd ComfyUI
|
| 22 |
+
pip install -r requirements.txt -q
|
| 23 |
+
cd ..
|
| 24 |
+
echo "β ComfyUI installed"
|
| 25 |
+
|
| 26 |
+
# Step 3: Install ComfyUI-GGUF Node
|
| 27 |
+
echo ""
|
| 28 |
+
echo "[3/5] Installing ComfyUI-GGUF node..."
|
| 29 |
+
mkdir -p ComfyUI/custom_nodes
|
| 30 |
+
if [ ! -d "ComfyUI/custom_nodes/ComfyUI-GGUF" ]; then
|
| 31 |
+
git clone --depth 1 https://github.com/city96/ComfyUI-GGUF.git ComfyUI/custom_nodes/ComfyUI-GGUF
|
| 32 |
+
fi
|
| 33 |
+
if [ -f "ComfyUI/custom_nodes/ComfyUI-GGUF/requirements.txt" ]; then
|
| 34 |
+
pip install -r ComfyUI/custom_nodes/ComfyUI-GGUF/requirements.txt -q
|
| 35 |
+
fi
|
| 36 |
+
echo "β ComfyUI-GGUF installed"
|
| 37 |
+
|
| 38 |
+
# Step 4: Download Model
|
| 39 |
+
echo ""
|
| 40 |
+
echo "[4/5] Downloading FLUX model..."
|
| 41 |
+
mkdir -p models
|
| 42 |
+
mkdir -p ComfyUI/models/checkpoints
|
| 43 |
+
|
| 44 |
+
MODEL_FILE="flux-2-klein-4b-Q4_K_M.gguf"
|
| 45 |
+
URL="https://huggingface.co/unsloth/FLUX.2-klein-4B-GGUF/resolve/main/${MODEL_FILE}"
|
| 46 |
+
|
| 47 |
+
if [ ! -f "models/${MODEL_FILE}" ]; then
|
| 48 |
+
echo " Downloading ${MODEL_FILE}..."
|
| 49 |
+
wget -O "models/${MODEL_FILE}" "${URL}" --progress=bar:force:noscroll --no-check-certificate
|
| 50 |
+
else
|
| 51 |
+
echo " Model already exists"
|
| 52 |
+
fi
|
| 53 |
+
|
| 54 |
+
# Copy to ComfyUI directory
|
| 55 |
+
cp "models/${MODEL_FILE}" "ComfyUI/models/checkpoints/"
|
| 56 |
+
SIZE=$(du -h "models/${MODEL_FILE}" | cut -f1)
|
| 57 |
+
echo "β Model downloaded (${SIZE})"
|
| 58 |
+
|
| 59 |
+
# Step 5: Download VAE and CLIP (needed for Flux workflow)
|
| 60 |
+
echo ""
|
| 61 |
+
echo "[5/5] Downloading supporting models..."
|
| 62 |
+
|
| 63 |
+
# VAE
|
| 64 |
+
VAE_URL="https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors"
|
| 65 |
+
mkdir -p ComfyUI/models/vae
|
| 66 |
+
if [ ! -f "ComfyUI/models/vae/ae.safetensors" ]; then
|
| 67 |
+
wget -O "ComfyUI/models/vae/ae.safetensors" "$VAE_URL" -q
|
| 68 |
+
fi
|
| 69 |
+
echo "β VAE downloaded"
|
| 70 |
+
|
| 71 |
+
# CLIP Text Encoder (T5)
|
| 72 |
+
CLIP_URL="https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors"
|
| 73 |
+
mkdir -p ComfyUI/models/clip
|
| 74 |
+
if [ ! -f "ComfyUI/models/clip/t5xxl_fp16.safetensors" ]; then
|
| 75 |
+
wget -O "ComfyUI/models/clip/t5xxl_fp16.safetensors" "$CLIP_URL" -q
|
| 76 |
+
fi
|
| 77 |
+
echo "β CLIP encoder downloaded"
|
| 78 |
+
|
| 79 |
+
echo ""
|
| 80 |
+
echo "=========================================="
|
| 81 |
+
echo "β
BUILD COMPLETE!"
|
| 82 |
+
echo "=========================================="
|
| 83 |
+
echo ""
|
| 84 |
+
echo "Installed:"
|
| 85 |
+
echo " β’ ComfyUI"
|
| 86 |
+
echo " β’ ComfyUI-GGUF node"
|
| 87 |
+
echo " β’ Flux model (${MODEL_FILE})"
|
| 88 |
+
echo " β’ VAE (ae.safetensors)"
|
| 89 |
+
echo " β’ CLIP (t5xxl_fp16.safetensors)"
|
| 90 |
+
echo ""
|
| 91 |
+
echo "Ready to generate images!"
|