Download wan.sh from nathanglm/sofia: direct link, hf CLI and curl.
- Browser
- Download file 17.6 kB
-
https://huggingface.co/nathanglm/sofia/resolve/main/wan.sh
- Command line
-
hf download hf://nathanglm/sofia/wan.sh
-
curl -L -o wan.sh https://huggingface.co/nathanglm/sofia/resolve/main/wan.sh
17.6 kB
| source /venv/main/bin/activate | |
| COMFYUI_DIR=${WORKSPACE}/ComfyUI | |
| # Packages are installed after nodes so we can fix them... | |
| APT_PACKAGES=( | |
| #"package-1" | |
| #"package-2" | |
| ) | |
| PIP_PACKAGES=( | |
| "mediapipe==0.10.21" | |
| ) | |
| NODES=( | |
| "https://github.com/ltdrdata/ComfyUI-Manager" | |
| "https://github.com/rgthree/rgthree-comfy" | |
| "https://github.com/ltdrdata/ComfyUI-Impact-Pack" | |
| "https://github.com/yolain/ComfyUI-Easy-Use" | |
| "https://github.com/ssitu/ComfyUI_UltimateSDUpscale" | |
| "https://github.com/sipherxyz/comfyui-art-venture" | |
| "https://github.com/ltdrdata/ComfyUI-Impact-Subpack" | |
| "https://github.com/moonwhaler/comfyui-moonpack" | |
| "https://github.com/gseth/ControlAltAI-Nodes" | |
| "https://github.com/vrgamegirl19/comfyui-vrgamedevgirl" | |
| "https://github.com/numz/ComfyUI-SeedVR2_VideoUpscaler" | |
| "https://github.com/robertvoy/ComfyUI-Flux-Continuum" | |
| "https://github.com/ltdrdata/was-node-suite-comfyui" | |
| "https://github.com/ChangeTheConstants/SeedVarianceEnhancer" | |
| "https://github.com/city96/ComfyUI-GGUF" | |
| "https://github.com/kijai/ComfyUI-KJNodes" | |
| "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes" | |
| "https://github.com/pythongosssss/ComfyUI-Custom-Scripts" | |
| "https://github.com/kijai/ComfyUI-WanVideoWrapper" | |
| "https://github.com/PGCRT/CRT-Nodes" | |
| "https://github.com/chibiace/ComfyUI-Chibi-Nodes" | |
| "https://github.com/crystian/comfyui-crystools" | |
| "https://github.com/kijai/ComfyUI-MelBandRoFormer" | |
| "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite" | |
| "https://github.com/kijai/ComfyUI-WanAnimatePreprocess" | |
| "https://github.com/Smirnov75/ComfyUI-mxToolkit" | |
| "https://github.com/chrisgoringe/cg-use-everywhere" | |
| "https://github.com/kijai/ComfyUI-Florence2" | |
| "https://github.com/kijai/ComfyUI-segment-anything-2" | |
| "https://github.com/un-seen/comfyui-tensorops" | |
| "https://github.com/jamesWalker55/comfyui-various" | |
| "https://github.com/cubiq/ComfyUI_essentials" | |
| "https://github.com/Daxamur/DaxNodes" | |
| "https://github.com/ClownsharkBatwing/RES4LYF" | |
| "https://github.com/chrisgoringe/cg-image-filter" | |
| "https://github.com/M1kep/ComfyLiterals" | |
| "https://github.com/evanspearman/ComfyMath" | |
| "https://github.com/digitaljohn/comfyui-propost" | |
| "https://github.com/Fannovel16/ComfyUI-Frame-Interpolation" | |
| ) | |
| WORKFLOWS=( | |
| "https://huggingface.co/nathanglm/sofia/resolve/main/WAN%20v1.json" | |
| "https://huggingface.co/nathanglm/sofia/resolve/main/WAN%20ANIMATE%20v1.json" | |
| ) | |
| SAMS=( | |
| ) | |
| CLIP=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/umt5-xxl-enc-bf16.safetensors" | |
| "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" | |
| ) | |
| CLIP_VISION=( | |
| "https://huggingface.co/openai/clip-vit-large-patch14/resolve/main/model.safetensors|clip-vit-large-patch14.safetensors" | |
| "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/clip_vision/clip_vision_h.safetensors" | |
| ) | |
| CHECKPOINT_MODELS=( | |
| ) | |
| BBOX=( | |
| ) | |
| UNET_MODELS=( | |
| ) | |
| UPSCALE_MODELS=( | |
| "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth" | |
| "https://huggingface.co/lllyasviel/Annotators/resolve/main/RealESRGAN_x4plus.pth" | |
| ) | |
| # Format: "URL|filename.safetensors" | |
| LORA_MODELS=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/LoRAs/Wan22_relight/WanAnimate_relight_lora_fp16.safetensors" | |
| "https://huggingface.co/lightx2v/Wan2.2-I2V-A14B-Moe-Distill-Lightx2v/resolve/main/loras/low_noise_model_rank64.safetensors|LIGHTX2V_I2V_2_2_LOW.safetensors" | |
| "https://huggingface.co/lightx2v/Wan2.2-I2V-A14B-Moe-Distill-Lightx2v/resolve/main/loras/high_noise_model_rank64.safetensors|LIGHTX2V_I2V_2_2_HIGH.safetensors" | |
| "https://civitai.com/api/download/models/2140962?type=Model&format=SafeTensor&size=full&fp=fp16|Wan21_I2V_14B_lightx2v_cfg_step_distill_lora_rank64.safetensors" | |
| "https://civitai.com/api/download/models/2066914?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-T2V-2.2-Lenovo-UltraReal.safetensors" | |
| "https://civitai.com/api/download/models/2209481?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Perfect-Fingering-LOW-v1.safetensors" | |
| "https://civitai.com/api/download/models/2209275?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Perfect-Fingering-HIGH-v1.safetensors" | |
| "https://civitai.com/api/download/models/2553271?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-DR34ML4Y-All-In-One-NSFW-LOW-v2.safetensors" | |
| "https://civitai.com/api/download/models/2553151?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-DR34ML4Y-All-In-One-NSFW-HIGH-v2.safetensors" | |
| "https://civitai.com/api/download/models/2012120?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Genitals-helper.safetensors" | |
| "https://civitai.com/api/download/models/2073605?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-General-NSFW-HIGH.safetensors" | |
| "https://civitai.com/api/download/models/2083303?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-General-NSFW-LOW.safetensors" | |
| "https://civitai.com/api/download/models/2405949?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Dildo-Classic-Closeup-LOW-v2.safetensors" | |
| "https://civitai.com/api/download/models/2405940?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Dildo-Classic-Closeup-HIGH-v2.safetensors" | |
| "https://civitai.com/api/download/models/2405930?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Dildo-Classic-Fullbody-LOW-v2.safetensors" | |
| "https://civitai.com/api/download/models/2405917?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Dildo-Classic-Fullbody-HIGH-v2.safetensors" | |
| "https://civitai.com/api/download/models/2448070?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Breast-Play-LOW-v2.safetensors" | |
| "https://civitai.com/api/download/models/2448064?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Breast-Play-HIGH-v2.safetensors" | |
| "https://civitai.com/api/download/models/2564047?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Rub-Pussy-LOW.safetensors" | |
| "https://civitai.com/api/download/models/2563945?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Rub-Pussy-HIGH.safetensors" | |
| "https://civitai.com/api/download/models/2098396?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-POV-Missionary-LOW.safetensors" | |
| "https://civitai.com/api/download/models/2098405?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-POV-Missionary-HIGH.safetensors" | |
| "https://civitai.com/api/download/models/2665810?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-T2V-2.2-Boobs-Physics-LOW-v8.safetensors" | |
| "https://civitai.com/api/download/models/2661167?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-T2V-2.2-Boobs-Physics-HIGH-v8.safetensors" | |
| "https://civitai.com/api/download/models/2347125?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Ass-shaking-dance-LOW-v2.safetensors" | |
| "https://civitai.com/api/download/models/2347127?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Ass-shaking-dance-HIGH-v2.safetensors" | |
| "https://civitai.com/api/download/models/2191270?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Bouncing-Boobs-LOW.safetensors" | |
| "https://civitai.com/api/download/models/2191217?type=Model&format=SafeTensor&size=full&fp=fp16|WAN-I2V-2.2-Bouncing-Boobs-HIGH.safetensors" | |
| ) | |
| VAE_MODELS=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy/blob/main/FlashVSR/Wan2_1_FlashVSR_TCDecoder_fp32.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors" | |
| ) | |
| DIFFUSION_MODELS=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/Wan22Animate/Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/FlashVSR/Wan2_1-T2V-1_3B_FlashVSR_fp32.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/FlashVSR/Wan2_1_FlashVSR_LQ_proj_model_bf16.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/Wan22Animate/Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-HIGH_fp8_e4m3fn_scaled_KJ.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-LOW_fp8_e4m3fn_scaled_KJ.safetensors" | |
| ) | |
| TEXT_ENCODERS=( | |
| ) | |
| DETECTION=( | |
| "https://huggingface.co/JunkyByte/easy_ViTPose/resolve/main/onnx/wholebody/vitpose-l-wholebody.onnx" | |
| "https://huggingface.co/Wan-AI/Wan2.2-Animate-14B/resolve/main/process_checkpoint/det/yolov10m.onnx" | |
| ) | |
| ESRGAN_MODELS=( | |
| ) | |
| CONTROLNET_MODELS=( | |
| ) | |
| ### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ### | |
| function provisioning_start() { | |
| provisioning_print_header | |
| provisioning_get_apt_packages | |
| provisioning_get_nodes | |
| provisioning_get_pip_packages | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/sams" \ | |
| "${SAMS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/checkpoints" \ | |
| "${CHECKPOINT_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/ultralytics/bbox" \ | |
| "${BBOX[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/unet" \ | |
| "${UNET_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/clip" \ | |
| "${CLIP[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/clip_vision" \ | |
| "${CLIP_VISION[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/loras" \ | |
| "${LORA_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/detection" \ | |
| "${DETECTION[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/diffusion_models" \ | |
| "${DIFFUSION_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/upscale_models" \ | |
| "${UPSCALE_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/text_encoders" \ | |
| "${TEXT_ENCODERS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/controlnet" \ | |
| "${CONTROLNET_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/vae" \ | |
| "${VAE_MODELS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/user/default/workflows" \ | |
| "${WORKFLOWS[@]}" | |
| provisioning_get_files \ | |
| "${COMFYUI_DIR}/models/esrgan" \ | |
| "${ESRGAN_MODELS[@]}" | |
| provisioning_print_end | |
| } | |
| function provisioning_get_apt_packages() { | |
| if [[ -n $APT_PACKAGES ]]; then | |
| sudo $APT_INSTALL ${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=("$@") | |
| printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir" | |
| for entry in "${arr[@]}"; do | |
| # Support "URL|filename" format for custom filenames | |
| if [[ "$entry" == *"|"* ]]; then | |
| url="${entry%%|*}" | |
| filename="${entry##*|}" | |
| else | |
| url="$entry" | |
| filename="" | |
| fi | |
| printf "Downloading: %s\n" "${url}" | |
| provisioning_download "${url}" "${dir}" "${filename}" | |
| 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" | |
| } | |
| function provisioning_print_end() { | |
| printf "\nProvisioning complete: Application will start now\n\n" | |
| } | |
| function provisioning_has_valid_hf_token() { | |
| [[ -n "$HF_TOKEN" ]] || return 1 | |
| url="https://huggingface.co/api/whoami-v2" | |
| response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \ | |
| -H "Authorization: Bearer $HF_TOKEN" \ | |
| -H "Content-Type: application/json") | |
| if [ "$response" -eq 200 ]; then | |
| return 0 | |
| else | |
| return 1 | |
| fi | |
| } | |
| function provisioning_has_valid_civitai_token() { | |
| [[ -n "$CIVITAI_TOKEN" ]] || return 1 | |
| url="https://civitai.com/api/v1/models?hidden=1&limit=1" | |
| response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \ | |
| -H "Authorization: Bearer $CIVITAI_TOKEN" \ | |
| -H "Content-Type: application/json") | |
| if [ "$response" -eq 200 ]; then | |
| return 0 | |
| else | |
| return 1 | |
| fi | |
| } | |
| # Download CivitAI models with curl (pure bash) | |
| function download_civitai_bash() { | |
| local url="$1" | |
| local output_dir="$2" | |
| local forced_filename="$3" | |
| local model_id="" | |
| if [[ $url =~ /models/([0-9]+) ]]; then | |
| model_id="${BASH_REMATCH[1]}" | |
| else | |
| printf "ERROR: Could not extract model ID from URL\n" | |
| return 1 | |
| fi | |
| printf "Downloading CivitAI model %s...\n" "$model_id" | |
| if [[ -n "$forced_filename" ]]; then | |
| local output_file="${output_dir}/${forced_filename}" | |
| if [[ -f "$output_file" ]]; then | |
| printf "File already exists: %s\n" "$forced_filename" | |
| return 0 | |
| fi | |
| printf "Downloading to: %s\n" "$forced_filename" | |
| if [[ -n "$CIVITAI_TOKEN" ]]; then | |
| curl -L -o "$output_file" --progress-bar -H "Authorization: Bearer $CIVITAI_TOKEN" "$url" | |
| else | |
| curl -L -o "$output_file" --progress-bar "$url" | |
| fi | |
| if [[ $? -eq 0 ]]; then | |
| printf "Download completed: %s\n" "$forced_filename" | |
| return 0 | |
| else | |
| printf "ERROR: Download failed for model %s\n" "$model_id" | |
| return 1 | |
| fi | |
| fi | |
| local redirect_url="" | |
| if [[ -n "$CIVITAI_TOKEN" ]]; then | |
| redirect_url=$(curl -s -I -L -H "Authorization: Bearer $CIVITAI_TOKEN" "$url" | grep -i "^location:" | tail -1 | sed 's/location: //i' | tr -d '\r\n') | |
| else | |
| redirect_url=$(curl -s -I -L "$url" | grep -i "^location:" | tail -1 | sed 's/location: //i' | tr -d '\r\n') | |
| fi | |
| if [[ -z "$redirect_url" ]]; then | |
| printf "ERROR: Could not get redirect URL for model %s\n" "$model_id" | |
| return 1 | |
| fi | |
| local filename="" | |
| if [[ $redirect_url =~ response-content-disposition=attachment.*filename%3D%22([^%\"]+) ]]; then | |
| filename="${BASH_REMATCH[1]}" | |
| filename=$(echo "$filename" | sed 's/%20/ /g; s/%2D/-/g; s/%2E/./g; s/%5F/_/g') | |
| elif [[ $redirect_url =~ filename=\"([^\"]+)\" ]]; then | |
| filename="${BASH_REMATCH[1]}" | |
| elif [[ $redirect_url =~ filename=([^&]+) ]]; then | |
| filename="${BASH_REMATCH[1]}" | |
| else | |
| local path_part=$(echo "$redirect_url" | sed 's/?.*//') | |
| filename=$(basename "$path_part") | |
| if [[ ! "$filename" =~ \.(safetensors|pt|pth|ckpt|bin)$ ]]; then | |
| filename="${filename}.safetensors" | |
| fi | |
| fi | |
| filename=$(printf '%b' "${filename//%/\\x}") | |
| if [[ -z "$filename" ]] || [[ "$filename" == "." ]] || [[ "$filename" == ".safetensors" ]]; then | |
| filename="civitai_${model_id}.safetensors" | |
| fi | |
| local output_file="${output_dir}/${filename}" | |
| if [[ -f "$output_file" ]]; then | |
| printf "File already exists: %s\n" "$filename" | |
| return 0 | |
| fi | |
| printf "Downloading to: %s\n" "$filename" | |
| curl -L -o "$output_file" --progress-bar "$redirect_url" | |
| if [[ $? -eq 0 ]]; then | |
| printf "Download completed: %s\n" "$filename" | |
| return 0 | |
| else | |
| printf "ERROR: Download failed for model %s\n" "$model_id" | |
| return 1 | |
| fi | |
| } | |
| # Download from $1 URL to $2 file path, with optional $3 forced filename | |
| function provisioning_download() { | |
| local url="$1" | |
| local dir="$2" | |
| local forced_filename="$3" | |
| if [[ $url =~ ^https://civitai\.com/api/download/models/([0-9]+) ]]; then | |
| download_civitai_bash "$url" "$dir" "$forced_filename" | |
| else | |
| if [[ -n "$forced_filename" ]]; then | |
| wget -qnc --show-progress -e dotbytes="${4:-4M}" -O "${dir}/${forced_filename}" "$url" | |
| else | |
| wget -qnc --content-disposition --show-progress -e dotbytes="${4:-4M}" -P "$dir" "$url" | |
| fi | |
| fi | |
| } | |
| # Allow user to disable provisioning if they started with a script they didn't want | |
| if [[ ! -f /.noprovisioning ]]; then | |
| provisioning_start | |
| fi |