Skip to content

Instantly share code, notes, and snippets.

@salsa2k
Last active December 30, 2025 00:22
Show Gist options
  • Select an option

  • Save salsa2k/118ec8d5c61d9bdb0a2ace6f70bbbeca to your computer and use it in GitHub Desktop.

Select an option

Save salsa2k/118ec8d5c61d9bdb0a2ace6f70bbbeca to your computer and use it in GitHub Desktop.
#!/bin/bash
# VAST.ai ComfyUI Provisioning Script
# Use this script with VAST.ai's ComfyUI Serverless template
# Set the PROVISIONING_SCRIPT environment variable to the raw URL of this script
# VAST.ai uses /opt/ComfyUI as the base path
BASE_DIR="/opt/ComfyUI/models"
echo "=== YOR ComfyUI Model Provisioning ==="
echo "Creating directory structure..."
mkdir -p "$BASE_DIR/checkpoints"
mkdir -p "$BASE_DIR/unet"
mkdir -p "$BASE_DIR/diffusion_models"
mkdir -p "$BASE_DIR/vae"
mkdir -p "$BASE_DIR/text_encoders"
# Custom nodes directory
CUSTOM_NODES_DIR="/opt/ComfyUI/custom_nodes"
echo "Downloading models..."
# Helper function to download if not exists
download_if_missing() {
local url="$1"
local dest="$2"
if [ -f "$dest" ]; then
echo "✓ File exists, skipping: $dest"
else
echo "↓ Downloading: $dest"
wget -q --show-progress -O "$dest" "$url"
fi
}
# --- FLUX Dev FP8 ---
download_if_missing \
"https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev-fp8.safetensors" \
"$BASE_DIR/checkpoints/flux1-dev-fp8.safetensors"
# --- FLUX Kontext FP8 ---
echo "Using FP8 Kontext for cloud GPU..."
download_if_missing \
"https://huggingface.co/Comfy-Org/flux1-kontext-dev_ComfyUI/resolve/main/split_files/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors" \
"$BASE_DIR/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors"
# --- ZTurbo Diffusion Model ---
download_if_missing \
"https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/diffusion_models/z_image_turbo_bf16.safetensors" \
"$BASE_DIR/diffusion_models/z_image_turbo_bf16.safetensors"
# --- ZTurbo VAE ---
download_if_missing \
"https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors" \
"$BASE_DIR/vae/ae.safetensors"
# --- Qwen 3.4B (CLIP) ---
download_if_missing \
"https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors" \
"$BASE_DIR/text_encoders/qwen_3_4b.safetensors"
# --- CLIP-L Encoder ---
download_if_missing \
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors" \
"$BASE_DIR/text_encoders/clip_l.safetensors"
# --- T5-XXL FP8 ---
download_if_missing \
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn_scaled.safetensors" \
"$BASE_DIR/text_encoders/t5xxl_fp8_e4m3fn_scaled.safetensors"
# --- Install Custom Nodes ---
echo ""
echo "Installing custom nodes..."
# Base64 to Image node (required for character variant generation)
if [ ! -d "$CUSTOM_NODES_DIR/comfyui-base64-to-image" ]; then
echo "↓ Installing comfyui-base64-to-image..."
cd "$CUSTOM_NODES_DIR"
git clone https://github.com/glowcone/comfyui-base64-to-image
else
echo "✓ comfyui-base64-to-image already installed"
fi
echo ""
echo "=== Provisioning Complete ==="
echo "Models installed at: $BASE_DIR"
echo "Custom nodes installed at: $CUSTOM_NODES_DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment