Last active
November 27, 2025 08:19
-
-
Save CestDiego/8172bd24b43ed004aa7d67db42ef02c7 to your computer and use it in GitHub Desktop.
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 | |
| # --- CONFIGURATION --- | |
| BASE="${VOLUME_ROOT:-/workspace/runpod-slim}/ComfyUI" | |
| MIN_SIZE_BYTES=10485760 # 10MB | |
| # --- PHASE 1: PREP --- | |
| echo "--- ⚙️ Phase 1: Environment Setup ---" | |
| # Install aria2 if missing | |
| if ! command -v aria2c &> /dev/null; then | |
| echo "📦 Installing aria2..." | |
| apt-get update -qq && apt-get install -y -qq aria2 | |
| else | |
| echo "✅ aria2 is already installed." | |
| fi | |
| # Create Directories | |
| mkdir -p "$BASE/models/diffusion_models" | |
| mkdir -p "$BASE/models/text_encoders" | |
| mkdir -p "$BASE/models/vae" | |
| # --- PHASE 2: GENERATE LIST --- | |
| # We write the file line-by-line to ensure perfect formatting | |
| # format: | |
| # URL | |
| # out=filename | |
| # dir=/path/to/save | |
| rm -f /tmp/comfy_downloads.txt | |
| # 1. Diffusion Model | |
| echo "https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/diffusion_models/z_image_turbo_bf16.safetensors" >> /tmp/comfy_downloads.txt | |
| echo " out=z_image_turbo_bf16.safetensors" >> /tmp/comfy_downloads.txt | |
| echo " dir=$BASE/models/diffusion_models" >> /tmp/comfy_downloads.txt | |
| # 2. Text Encoder | |
| echo "https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/text_encoders/qwen_3_4b.safetensors" >> /tmp/comfy_downloads.txt | |
| echo " out=qwen_3_4b.safetensors" >> /tmp/comfy_downloads.txt | |
| echo " dir=$BASE/models/text_encoders" >> /tmp/comfy_downloads.txt | |
| # 3. VAE | |
| echo "https://huggingface.co/Comfy-Org/z_image_turbo/resolve/main/split_files/vae/ae.safetensors" >> /tmp/comfy_downloads.txt | |
| echo " out=ae.safetensors" >> /tmp/comfy_downloads.txt | |
| echo " dir=$BASE/models/vae" >> /tmp/comfy_downloads.txt | |
| # --- PHASE 3: DOWNLOAD --- | |
| echo "--- ⬇️ Phase 2: Downloading Models (Parallel) ---" | |
| # Run Aria2 | |
| aria2c -x 16 -s 16 -j 3 --input-file=/tmp/comfy_downloads.txt --console-log-level=warn --summary-interval=1 --allow-overwrite=true | |
| # --- PHASE 4: HEALTH CHECK --- | |
| echo "--- 🏥 Phase 3: Verification ---" | |
| files=( | |
| "$BASE/models/diffusion_models/z_image_turbo_bf16.safetensors|Diffusion Model" | |
| "$BASE/models/text_encoders/qwen_3_4b.safetensors|Text Encoder" | |
| "$BASE/models/vae/ae.safetensors|VAE" | |
| ) | |
| OVERALL_STATUS="PASS" | |
| printf "%-25s %-15s %-15s\n" "MODEL" "SIZE" "STATUS" | |
| echo "--------------------------------------------------------" | |
| for item in "${files[@]}"; do | |
| path="${item%%|*}" | |
| name="${item##*|}" | |
| if [ ! -f "$path" ]; then | |
| printf "%-25s %-15s %-15s\n" "$name" "MISSING" "❌ FAIL" | |
| OVERALL_STATUS="FAIL" | |
| continue | |
| fi | |
| size_bytes=$(stat -c%s "$path") | |
| human_size=$(du -h "$path" | cut -f1) | |
| if [ "$size_bytes" -lt "$MIN_SIZE_BYTES" ]; then | |
| printf "%-25s %-15s %-15s\n" "$name" "$human_size" "⚠️ CORRUPT" | |
| OVERALL_STATUS="FAIL" | |
| else | |
| printf "%-25s %-15s %-15s\n" "$name" "$human_size" "✅ READY" | |
| fi | |
| done | |
| echo "--------------------------------------------------------" | |
| if [ "$OVERALL_STATUS" == "PASS" ]; then | |
| echo "🎉 Success! All models downloaded and verified." | |
| else | |
| echo "❌ Errors detected." | |
| fi |
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 | |
| # --- CONFIGURATION --- | |
| BASE="${VOLUME_ROOT:-/workspace/runpod-slim}/ComfyUI" | |
| # --- PHASE 1: PREP & INSTALL --- | |
| echo "--- ⚙️ Phase 1: Environment Setup ---" | |
| # 1. Install uv (The modern Python package manager) | |
| # This solves the "pip conflict" by isolating dependencies | |
| if ! command -v uv &> /dev/null; then | |
| echo "📦 Installing uv..." | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| # Add uv to PATH for this session | |
| source $HOME/.cargo/env 2>/dev/null || export PATH="$HOME/.cargo/bin:$PATH" | |
| else | |
| echo "✅ uv is already installed." | |
| fi | |
| # 2. Ask for Token | |
| echo "---------------------------------------------------------------------" | |
| echo "🛑 AUTHENTICATION REQUIRED" | |
| echo "Flux Fill Dev is a gated model. You need a Hugging Face Token." | |
| echo "Get it here: https://huggingface.co/settings/tokens" | |
| echo "---------------------------------------------------------------------" | |
| read -p "🔑 Paste your HF Token (starts with hf_...): " HF_TOKEN | |
| if [ -z "$HF_TOKEN" ]; then | |
| echo "❌ Error: Token cannot be empty." | |
| exit 1 | |
| fi | |
| # 3. Create Directories | |
| mkdir -p "$BASE/models/diffusion_models" | |
| mkdir -p "$BASE/models/clip" | |
| mkdir -p "$BASE/models/vae" | |
| # --- PHASE 2: ISOLATED DOWNLOADER (via uv) --- | |
| # We use 'uv run' to create a temporary environment with the latest | |
| # 'huggingface_hub' installed, completely ignoring system package conflicts. | |
| echo "--- ⬇️ Downloading Models (via uv) ---" | |
| uv run --with huggingface_hub python - <<EOF | |
| import os | |
| from huggingface_hub import hf_hub_download, login | |
| try: | |
| # 1. Authenticate | |
| print(f"🔐 Authenticating...") | |
| login(token="$HF_TOKEN", add_to_git_credential=True) | |
| # 2. Define Targets | |
| base_path = "$BASE" | |
| downloads = [ | |
| { | |
| "repo": "black-forest-labs/FLUX.1-Fill-dev", | |
| "file": "flux1-fill-dev.safetensors", | |
| "dir": f"{base_path}/models/diffusion_models" | |
| }, | |
| { | |
| "repo": "aoxo/flux.1dev-abliteratedv2", | |
| "file": "flux.1dev-abliteratedv2.safetensors", | |
| "dir": f"{base_path}/models/diffusion_models" | |
| }, | |
| { | |
| "repo": "comfyanonymous/flux_text_encoders", | |
| "file": "t5xxl_fp16.safetensors", | |
| "dir": f"{base_path}/models/clip" | |
| }, | |
| { | |
| "repo": "comfyanonymous/flux_text_encoders", | |
| "file": "clip_l.safetensors", | |
| "dir": f"{base_path}/models/clip" | |
| }, | |
| { | |
| "repo": "black-forest-labs/FLUX.1-schnell", | |
| "file": "ae.safetensors", | |
| "dir": f"{base_path}/models/vae" | |
| } | |
| ] | |
| # 3. Run Downloads | |
| for item in downloads: | |
| print(f"⬇️ Downloading {item['file']}...") | |
| try: | |
| hf_hub_download( | |
| repo_id=item['repo'], | |
| filename=item['file'], | |
| local_dir=item['dir'], | |
| local_dir_use_symlinks=False | |
| ) | |
| print(f"✅ Downloaded {item['file']}") | |
| except Exception as e: | |
| print(f"❌ Failed to download {item['file']}: {e}") | |
| except Exception as e: | |
| print(f"❌ Critical Error: {e}") | |
| EOF | |
| # --- PHASE 3: HEALTH CHECK --- | |
| echo "--- 🏥 Verification ---" | |
| files=( | |
| "$BASE/models/diffusion_models/flux1-fill-dev.safetensors" | |
| "$BASE/models/clip/t5xxl_fp16.safetensors" | |
| "$BASE/models/clip/clip_l.safetensors" | |
| "$BASE/models/vae/ae.safetensors" | |
| ) | |
| OVERALL_STATUS="PASS" | |
| for path in "${files[@]}"; do | |
| if [ -f "$path" ]; then | |
| human_size=$(du -h "$path" | cut -f1) | |
| echo "✅ FOUND: $path ($human_size)" | |
| else | |
| echo "❌ MISSING: $path" | |
| OVERALL_STATUS="FAIL" | |
| fi | |
| done | |
| if [ "$OVERALL_STATUS" == "PASS" ]; then | |
| echo "🎉 Ready for Inpainting! (Official BF16 Quality)" | |
| else | |
| echo "⚠️ Some files failed to download. Check the python output above." | |
| fi | |
| # 1. Go to the custom_nodes folder | |
| cd /workspace/runpod-slim/ComfyUI/custom_nodes | |
| git clone https://github.com/glowcone/comfyui-base64-to-image.git | |
| chmod -R 777 comfyui-base64-to-image | |
| git clone https://github.com/AlekPet/ComfyUI_Custom_Nodes_AlekPet.git | |
| chmod -R 777 ComfyUI_Custom_Nodes_AlekPet | |
| echo "✅ Installed! NOW CLICK 'RESTART' INSIDE COMFTYUI." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment