Prefetch TAESD-XL + SDXL VAE from HuggingFace at startup
Build and push image / build (push) Successful in 1m27s

So live previews and the common SDXL VAE override are available
without manually downloading each time the pod starts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
donnyandClaude Opus 4.7 committed 2026-05-18 21:10:57 -07:00
1 parent 38117707e9
commit 6639fae0e9
1 file changed
+47 -1
+47 -1
View File
@@ -136,6 +136,50 @@ print("BRIA RMBG-1.4 downloaded")
PY PY
} }
# ----------------------------------------------------------------------------
# TAESD preview decoder + SDXL VAE — pulled from HuggingFace (the CivitAI
# auto-download path can't reach them). TAESD is what `--preview-method taesd`
# needs to stream live preview frames as the sampler runs; the SDXL VAE is
# the common override most users want available without a manual download.
# ----------------------------------------------------------------------------
download_hf_models() {
local vae_approx="$COMFYUI_DIR/models/vae_approx"
local vae_dir="$COMFYUI_DIR/models/vae"
mkdir -p "$vae_approx" "$vae_dir"
if [ -f "$vae_approx/taesdxl_decoder.safetensors" ] && [ -f "$vae_dir/sdxl_vae.safetensors" ]; then
log_info "TAESD-XL + SDXL VAE already present"
return
fi
log_step "Downloading TAESD-XL + SDXL VAE from HuggingFace"
python3 - <<PY || log_warn "TAESD / SDXL VAE download failed"
import os
from huggingface_hub import hf_hub_download
token = os.environ.get("HF_TOKEN") or None
# TAESD-XL decoder → models/vae_approx/taesdxl_decoder.safetensors
# (ComfyUI's preview system looks for this exact filename in vae_approx/.)
hf_hub_download(
repo_id="madebyollin/taesdxl",
filename="taesdxl_decoder.safetensors",
local_dir="$vae_approx",
token=token,
)
print("TAESD-XL ready")
# SDXL VAE → models/vae/sdxl_vae.safetensors
hf_hub_download(
repo_id="stabilityai/sdxl-vae",
filename="sdxl_vae.safetensors",
local_dir="$vae_dir",
token=token,
)
print("SDXL VAE ready")
PY
}
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# SageAttention (background) — ~3x sampler speedup on supported GPUs. # SageAttention (background) — ~3x sampler speedup on supported GPUs.
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@@ -216,6 +260,8 @@ install_sage_attention # background
download_bria_model & download_bria_model &
BRIA_PID=$! BRIA_PID=$!
wait $BRIA_PID || true download_hf_models &
HF_PID=$!
wait $BRIA_PID $HF_PID || true
start_comfyui start_comfyui