bjooo commited on
Commit
ea12399
ยท
verified ยท
1 Parent(s): 22ec27c

Upload pod_bootstrap.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. 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 ๋ Œ๋” ํƒญ์—์„œ ์—ฐ๊ฒฐ ํ™•์ธ -> ํ”„๋ฆฌํ”Œ๋ผ์ดํŠธ๋ฅผ ๋Œ๋ฆฐ๋‹ค."