Created
January 8, 2026 06:28
-
-
Save Sankalp0203/4a39e3ca09a1403d787031ea1c797f83 to your computer and use it in GitHub Desktop.
ComfyUI Wan 2.2 Provisioning plaknas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This file will be sourced in init.sh | |
| # Namespace functions with provisioning_ | |
| # https://raw.githubusercontent.com/ai-dock/comfyui/main/config/provisioning/default.sh | |
| # Packages are installed after nodes so we can fix them... | |
| APT_PACKAGES=( | |
| #"package-1" | |
| #"package-2" | |
| ) | |
| PIP_PACKAGES=( | |
| #"package-1" | |
| #"package-2" | |
| ) | |
| NODES=( | |
| "https://github.com/ltdrdata/ComfyUI-Manager" | |
| "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite" | |
| "https://github.com/Tumbler-Ridge/comfyui-sound-lab" | |
| "https://github.com/chflame163/ComfyUI-AudioLDM" | |
| "https://github.com/GeekyGhost/ComfyUI-Geeky-Kokoro-TTS" | |
| ) | |
| CHECKPOINT_MODELS=( | |
| "https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev-fp8.safetensors" | |
| ) | |
| UNET_MODELS=( | |
| ) | |
| # Wan 2.2 Models typically go into diffusion_models or unet, we will use diffusion_models as requested | |
| DIFFUSION_MODELS=( | |
| "https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers/resolve/main/wan2.2_t2v_high_noise_14B_fp8_scaled.safetensors" | |
| "https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers/resolve/main/wan2.2_t2v_low_noise_14B_fp8_scaled.safetensors" | |
| "https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers/resolve/main/wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors" | |
| "https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers/resolve/main/wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors" | |
| ) | |
| LORA_MODELS=( | |
| # "https://civitai.com/api/download/models/12345" | |
| ) | |
| VAE_MODELS=( | |
| "https://huggingface.co/Wan-AI/Wan2.1-T2V-14B/resolve/main/wan_2.1_vae.safetensors" | |
| "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors" | |
| ) | |
| CLIP_MODELS=( | |
| "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors" | |
| "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors" | |
| ) | |
| TEXT_ENCODER_MODELS=( | |
| "https://huggingface.co/city96/t5-v1_1-xxl-encoder-gguf/resolve/main/t5-v1_1-xxl-encoder-Q4_K_M.gguf" | |
| ) | |
| ESRGAN_MODELS=( | |
| ) | |
| CONTROLNET_MODELS=( | |
| ) | |
| ### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ### | |
| function provisioning_start() { | |
| if [[ ! -d /opt/environments/python ]]; then | |
| export COMPIFY_ENVIRONMENT_ID=default | |
| echo "Global env id: $COMPIFY_ENVIRONMENT_ID" | |
| fi | |
| local provisioning_start_time=$(date +%s) | |
| provisioning_print_header | |
| provisioning_get_apt_packages | |
| provisioning_get_nodes | |
| provisioning_get_pip_packages | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/checkpoints" \ | |
| "${CHECKPOINT_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/unet" \ | |
| "${UNET_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/diffusion_models" \ | |
| "${DIFFUSION_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/loras" \ | |
| "${LORA_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/controlnet" \ | |
| "${CONTROLNET_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/vae" \ | |
| "${VAE_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/esrgan" \ | |
| "${ESRGAN_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/clip" \ | |
| "${CLIP_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/text_encoders" \ | |
| "${TEXT_ENCODER_MODELS[@]}" | |
| provisioning_print_end "${provisioning_start_time}" | |
| } | |
| function provisioning_get_apt_packages() { | |
| if [[ -n $APT_PACKAGES ]]; then | |
| sudo apt-get update | |
| sudo apt-get install -y ${APT_PACKAGES[@]} | |
| fi | |
| } | |
| function provisioning_get_pip_packages() { | |
| if [[ -n $PIP_PACKAGES ]]; then | |
| pip install --no-cache-dir ${PIP_PACKAGES[@]} | |
| fi | |
| } | |
| function provisioning_get_nodes() { | |
| for repo in "${NODES[@]}"; do | |
| dir="${repo##*/}" | |
| path="${COMFYUI_DIR}/custom_nodes/${dir}" | |
| requirements="${path}/requirements.txt" | |
| if [[ -d $path ]]; then | |
| if [[ ${AUTO_UPDATE,,} != "false" ]]; then | |
| printf "Updating node: %s...\n" "${repo}" | |
| ( cd "$path" && git pull ) | |
| if [[ -e $requirements ]]; then | |
| pip install --no-cache-dir -r "$requirements" | |
| fi | |
| fi | |
| else | |
| printf "Downloading node: %s...\n" "${repo}" | |
| git clone "${repo}" "${path}" --recursive | |
| if [[ -e $requirements ]]; then | |
| pip install --no-cache-dir -r "${requirements}" | |
| fi | |
| fi | |
| done | |
| } | |
| function provisioning_get_files() { | |
| if [[ -z $2 ]]; then return 1; fi | |
| dir="$1" | |
| mkdir -p "$dir" | |
| shift | |
| arr=("$@") | |
| if [[ ${#arr[@]} -eq 0 ]]; then return; fi | |
| printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir" | |
| for url in "${arr[@]}"; do | |
| printf "Downloading: %s\n" "${url}" | |
| provisioning_download "${url}" "${dir}" | |
| printf "\n" | |
| done | |
| } | |
| function provisioning_print_header() { | |
| printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n" | |
| if [[ -n $HF_TOKEN ]]; then | |
| echo "HF_TOKEN detected" | |
| else | |
| echo "HF_TOKEN not detected - some downloads may fail" | |
| fi | |
| } | |
| function provisioning_print_end() { | |
| local start_time=$1 | |
| local end_time=$(date +%s) | |
| local duration=$((end_time - start_time)) | |
| printf "\nProvisioning complete in %d seconds\nApplication will start now\n\n" "$duration" | |
| } | |
| # Download from $1 URL to $2 file path | |
| function provisioning_download() { | |
| if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then | |
| auth_token="$HF_TOKEN" | |
| elif | |
| [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then | |
| auth_token="$CIVITAI_TOKEN" | |
| fi | |
| # Extract filename from URL or use content-disposition | |
| # We use wget for robustness | |
| if [[ -n $auth_token ]];then | |
| wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" | |
| else | |
| wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1" | |
| fi | |
| } | |
| # Auto-start if not sourced, or simple check | |
| if [[ ! -f /.noprovisioning ]]; then | |
| provisioning_start | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment