Download animate.sh from nathanglm/sofia: direct link, hf CLI and curl.
- Browser
- Download file 12.6 kB
-
https://huggingface.co/nathanglm/sofia/resolve/main/animate.sh
- Command line
-
hf download hf://nathanglm/sofia/animate.sh
-
curl -L -o animate.sh https://huggingface.co/nathanglm/sofia/resolve/main/animate.sh
12.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=( | |
| ) | |
| SAMS=( | |
| ) | |
| CLIP=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/umt5-xxl-enc-bf16.safetensors" | |
| ) | |
| CLIP_VISION=( | |
| ) | |
| CHECKPOINT_MODELS=( | |
| ) | |
| BBOX=( | |
| ) | |
| UNET_MODELS=( | |
| ) | |
| UPSCALE_MODELS=( | |
| ) | |
| # Format: "URL|filename.safetensors" | |
| LORA_MODELS=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/LoRAs/Wan22_Lightx2v/Wan_2_2_I2V_A14B_LOW_lightx2v_4step_lora_260412_rank_256_fp16.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank256_bf16.safetensors" | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Pusa/Wan21_PusaV1_LoRA_14B_rank512_bf16.safetensors" | |
| "https://huggingface.co/alibaba-pai/Wan2.2-Fun-Reward-LoRAs/resolve/main/Wan2.2-Fun-A14B-InP-low-noise-MPS.safetensors" | |
| "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/loras/wan2.2_animate_14B_relight_lora_bf16.safetensors" | |
| ) | |
| VAE_MODELS=( | |
| "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors" | |
| ) | |
| DIFFUSION_MODELS=( | |
| "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/diffusion_models/wan2.2_animate_14B_bf16.safetensors" | |
| ) | |
| TEXT_ENCODERS=( | |
| ) | |
| DETECTION=( | |
| "https://huggingface.co/Kijai/vitpose_comfy/resolve/main/onnx/vitpose_h_wholebody_model.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 |