Upload pod_bootstrap.sh with huggingface_hub
Browse files- pod_bootstrap.sh +92 -0
pod_bootstrap.sh
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
# ํ์์ ์คํํ๋ค. tools/pod_bootstrap.py script ๊ฐ ๋ง๋ ๋ค.
|
| 3 |
+
set -euo pipefail
|
| 4 |
+
|
| 5 |
+
COMFY_ROOT="${COMFY_ROOT:-}"
|
| 6 |
+
STAGE="$(mktemp -d)"
|
| 7 |
+
trap 'rm -rf "$STAGE"' EXIT
|
| 8 |
+
|
| 9 |
+
# ComfyUI ๋ณธ์ฒด ๊ฒฝ๋ก๋ ์ด๋ฏธ์ง๋ง๋ค ๋ค๋ฅด๋ค(runpod/comfyui ๋ /workspace/runpod-slim/ComfyUI).
|
| 10 |
+
if [ -z "$COMFY_ROOT" ]; then
|
| 11 |
+
for candidate in /workspace/ComfyUI /workspace/runpod-slim/ComfyUI /ComfyUI /root/ComfyUI /app/ComfyUI; do
|
| 12 |
+
if [ -f "$candidate/main.py" ]; then COMFY_ROOT="$candidate"; break; fi
|
| 13 |
+
done
|
| 14 |
+
fi
|
| 15 |
+
if [ ! -f "$COMFY_ROOT/main.py" ]; then
|
| 16 |
+
echo "ComfyUI ๋ณธ์ฒด๋ฅผ ์ฐพ์ง ๋ชปํ์ต๋๋ค. COMFY_ROOT=/์ค์ /๊ฒฝ๋ก ๋ก ์ง์ ํด ๋ค์ ์คํํ์ธ์." >&2
|
| 17 |
+
exit 1
|
| 18 |
+
fi
|
| 19 |
+
echo "ComfyUI: $COMFY_ROOT"
|
| 20 |
+
|
| 21 |
+
# ComfyUI ๊ฐ ์ฐ๋ ์ธํฐํ๋ฆฌํฐ(์ด๋ฏธ์ง์ ์ ์ฉ venv ๊ฐ ์๋ค).
|
| 22 |
+
PY="$(ls "$COMFY_ROOT"/.venv*/bin/python 2>/dev/null | head -1)"
|
| 23 |
+
[ -n "$PY" ] || PY="$(command -v python3 || command -v python)"
|
| 24 |
+
# hf CLI ๋ ์ด๋ฏธ์ง์ ์์ ์ ์๋ค. ์์ผ๋ฉด ๊ฐ์ ์ธํฐํ๋ฆฌํฐ์ huggingface_hub ๋ก ๋ฐ๋๋ค.
|
| 25 |
+
HF="${HF:-$(ls "$COMFY_ROOT"/.venv*/bin/hf 2>/dev/null | head -1)}"
|
| 26 |
+
if [ -z "$HF" ]; then HF="$(command -v hf || true)"; fi
|
| 27 |
+
if [ -z "$HF" ]; then echo "hf CLI ๊ฐ ์์ด ํ์ด์ฌ API๋ก ๋ด๋ ค๋ฐ์ต๋๋ค." >&2; fi
|
| 28 |
+
|
| 29 |
+
fetch() {
|
| 30 |
+
local repo="$1" name="$2" dest="$3"
|
| 31 |
+
if [ -n "$HF" ]; then
|
| 32 |
+
"$HF" download "$repo" "$name" --local-dir "$dest" >/dev/null
|
| 33 |
+
else
|
| 34 |
+
"$PY" -c 'import sys;from huggingface_hub import hf_hub_download;hf_hub_download(sys.argv[1],sys.argv[2],local_dir=sys.argv[3])' "$repo" "$name" "$dest" >/dev/null
|
| 35 |
+
fi
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
# ๋ชจ๋ธ: ๊ณต๊ฐ ์ ์ฅ์๋ผ ํ ํฐ์ด ํ์ ์๋ค. ๋ฐ์ ๋ค ์ด๋ฆ์ผ๋ก ์ฐพ์ ์ ์๋ฆฌ์ ์ฎ๊ธด๋ค.
|
| 39 |
+
pull() {
|
| 40 |
+
local repo="$1" name="$2" target="$3" src
|
| 41 |
+
fetch "$repo" "$name" "$STAGE/$repo"
|
| 42 |
+
src="$(find "$STAGE/$repo" -name "$name" -print -quit)"
|
| 43 |
+
if [ -z "$src" ]; then echo "HF์ ์์: $repo/$name" >&2; return 1; fi
|
| 44 |
+
install -D -m 644 "$src" "$COMFY_ROOT/models/$target"
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
mkdir -p "$COMFY_ROOT/models/unet" "$COMFY_ROOT/models/vae" \
|
| 48 |
+
"$COMFY_ROOT/models/text_encoders" "$COMFY_ROOT/models/loras" \
|
| 49 |
+
"$COMFY_ROOT/custom_nodes"
|
| 50 |
+
|
| 51 |
+
pull bjooo/wan2.2_loras "SVI_v2_PRO_Wan2.2-I2V-A14B_HIGH_lora_rank_128_fp16.safetensors" "loras/SVI_v2_PRO_Wan2.2-I2V-A14B_HIGH_lora_rank_128_fp16.safetensors"
|
| 52 |
+
pull bjooo/wan2.2_loras "SVI_v2_PRO_Wan2.2-I2V-A14B_LOW_lora_rank_128_fp16.safetensors" "loras/SVI_v2_PRO_Wan2.2-I2V-A14B_LOW_lora_rank_128_fp16.safetensors"
|
| 53 |
+
pull bjooo/wan2.2_loras "Wan2.1_I2V_14B_FusionX_LoRA.safetensors" "loras/Wan2.1_I2V_14B_FusionX_LoRA.safetensors"
|
| 54 |
+
pull bjooo/wan2.2_loras "Wan_2_2_I2V_A14B_HIGH_lightx2v_4step_lora_v1030_rank_64_bf16.safetensors" "loras/Wan_2_2_I2V_A14B_HIGH_lightx2v_4step_lora_v1030_rank_64_bf16.safetensors"
|
| 55 |
+
pull bjooo/wan2.2_loras "Wan_2_2_I2V_A14B_LOW_lightx2v_4step_lora_260412_rank_256_fp16.safetensors" "loras/Wan_2_2_I2V_A14B_LOW_lightx2v_4step_lora_260412_rank_256_fp16.safetensors"
|
| 56 |
+
pull bjooo/wan2.2_loras "2.2-I2V Reveal Penis_000003000_high_noise.safetensors" "loras/bodyparts/2.2-I2V Reveal Penis_000003000_high_noise.safetensors"
|
| 57 |
+
pull bjooo/wan2.2_loras "2.2-I2V Reveal Penis_000003000_low_noise.safetensors" "loras/bodyparts/2.2-I2V Reveal Penis_000003000_low_noise.safetensors"
|
| 58 |
+
pull bjooo/wan2.2_loras "PENISLORA_22_i2v_HIGH_e320.safetensors" "loras/bodyparts/PENISLORA_22_i2v_HIGH_e320.safetensors"
|
| 59 |
+
pull bjooo/wan2.2_loras "PENISLORA_22_i2v_LOW_e496.safetensors" "loras/bodyparts/PENISLORA_22_i2v_LOW_e496.safetensors"
|
| 60 |
+
pull bjooo/wan2.2_loras "erect_penis_epoch_80.safetensors" "loras/bodyparts/erect_penis_epoch_80.safetensors"
|
| 61 |
+
pull bjooo/wan2.2_loras "masturbation_cumshot_v1.1_e310.safetensors" "loras/masturbation/masturbation_cumshot_v1.1_e310.safetensors"
|
| 62 |
+
pull bjooo/clips "nsfw_wan_umt5-xxl_fp8_scaled.safetensors" "text_encoders/nsfw_wan_umt5-xxl_fp8_scaled.safetensors"
|
| 63 |
+
pull bjooo/unet "Wan2.2-I2V-A14B-HighNoise-Q8_0.gguf" "unet/Wan2.2-I2V-A14B-HighNoise-Q8_0.gguf"
|
| 64 |
+
pull bjooo/unet "Wan2.2-I2V-A14B-LowNoise-Q8_0.gguf" "unet/Wan2.2-I2V-A14B-LowNoise-Q8_0.gguf"
|
| 65 |
+
pull bjooo/clips "Wan2_1_VAE_bf16.safetensors" "vae/Wan2_1_VAE_bf16.safetensors"
|
| 66 |
+
|
| 67 |
+
# ์ด๋ฏธ์ง์ ๊ฐ์ ๊ณ์ด ํฉ์ด ๋ค์ด ์์ผ๋ฉด ๋๋ค. ๋ฆฌ๋
์ค๋ ๋์๋ฌธ์๋ฅผ ๊ตฌ๋ถํ๋ฏ๋ก
|
| 68 |
+
# ComfyUI-KJNodes ์ ์ฐ๋ฆฌ comfyui-kjnodes ๊ฐ ๊ณต์กดํ๋ฉด ๊ฐ์ ํด๋์ค๊ฐ ๋ ๋ฒ ๋ฑ๋ก๋๋ค.
|
| 69 |
+
for collide in ComfyUI-KJNodes; do
|
| 70 |
+
if [ -d "$COMFY_ROOT/custom_nodes/$collide" ]; then
|
| 71 |
+
mv "$COMFY_ROOT/custom_nodes/$collide" "$COMFY_ROOT/custom_nodes/$collide.disabled"
|
| 72 |
+
echo "์ถฉ๋ ํฉ์ ๊ป์ต๋๋ค: $collide"
|
| 73 |
+
fi
|
| 74 |
+
done
|
| 75 |
+
|
| 76 |
+
# ๋
ธ๋: ๋ก์ปฌ ์ค์น๋ณธ ๋ฒ๋ค + ํด๋ก ๊ฐ๋ฅํ ํฉ
|
| 77 |
+
fetch bjooo/customNode node_bundle.tar.gz "$STAGE/bundle"
|
| 78 |
+
tar -xzf "$STAGE/bundle/node_bundle.tar.gz" -C "$COMFY_ROOT/custom_nodes"
|
| 79 |
+
[ -d "$COMFY_ROOT/custom_nodes/RES4LYF" ] || git clone --depth 1 https://github.com/ClownsharkBatwing/RES4LYF "$COMFY_ROOT/custom_nodes/RES4LYF"
|
| 80 |
+
|
| 81 |
+
# ํฉ๋ณ ํ์ด์ฌ ์์กด์ฑ์ ComfyUI ๊ฐ ์ฐ๋ ์ธํฐํ๋ฆฌํฐ์ ๋ฃ์ด์ผ ํ๋ค.
|
| 82 |
+
for req in "$COMFY_ROOT"/custom_nodes/*/requirements.txt; do
|
| 83 |
+
[ -f "$req" ] || continue
|
| 84 |
+
"$PY" -m pip install -q -r "$req" || echo "์์กด์ฑ ์ค์น ์คํจ: $req" >&2
|
| 85 |
+
done
|
| 86 |
+
|
| 87 |
+
# ๊ฐ๋
๋
ธ๋๊ฐ ์คํ ์ค OpenRouter๋ฅผ ๋ถ๋ฅธ๋ค. ์์ผ๋ฉด ๋ ๋๊ฐ ์์ํ์๋ง์ ์ฃฝ๋๋ค.
|
| 88 |
+
if [ -z "${OPENROUTER_API_KEY:-}" ]; then
|
| 89 |
+
echo "๊ฒฝ๊ณ : OPENROUTER_API_KEY ๊ฐ ์์ต๋๋ค. SVI ๊ฐ๋
๋
ธ๋๊ฐ ์ฆ์ ์คํจํฉ๋๋ค." >&2
|
| 90 |
+
fi
|
| 91 |
+
|
| 92 |
+
echo "์๋ฃ. ComfyUI๋ฅผ ์ฌ์์ํ ๋ค ์ฌ์ด๋๋ฐ Runpod ๋ ๋ ํญ์์ ์ฐ๊ฒฐ ํ์ธ -> ํ๋ฆฌํ๋ผ์ดํธ๋ฅผ ๋๋ฆฐ๋ค."
|