olfronar commited on
Commit
18e723a
·
verified ·
1 Parent(s): 6b295f5

Upload install_models_ComfyUI.sh

Browse files
Files changed (1) hide show
  1. install_models_ComfyUI.sh +96 -0
install_models_ComfyUI.sh ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # =============================================
5
+ # ComfyUI models on persistent /workspace + symlink /ComfyUI/models
6
+ # Adds: FLUX ControlNet Union (InstantX)
7
+ # =============================================
8
+
9
+ # Персистентный путь под модели
10
+ WORK_PATH="/workspace/comfyui"
11
+ STORAGE_MODELS="$WORK_PATH/models"
12
+
13
+ # Подпапки моделей
14
+ CLIP_DIR="$STORAGE_MODELS/clip"
15
+ DIFF_DIR="$STORAGE_MODELS/diffusion_models" # Flux checkpoint
16
+ VAE_DIR="$STORAGE_MODELS/vae"
17
+ LORA_DIR="$STORAGE_MODELS/loras"
18
+ CN_DIR="$STORAGE_MODELS/controlnet" # <-- ControlNet сюда
19
+
20
+ # Создаём структуру
21
+ mkdir -p "$CLIP_DIR" "$DIFF_DIR" "$VAE_DIR" "$LORA_DIR" "$CN_DIR"
22
+
23
+ echo ">>> Using persistent storage: $STORAGE_MODELS"
24
+
25
+ # Симлинк /ComfyUI/models -> /workspace/comfyui/models
26
+ if [ ! -L /ComfyUI/models ]; then
27
+ echo ">>> Linking /ComfyUI/models -> $STORAGE_MODELS"
28
+ rm -rf /ComfyUI/models
29
+ ln -s "$STORAGE_MODELS" /ComfyUI/models
30
+ else
31
+ echo ">>> Symlink /ComfyUI/models already exists"
32
+ fi
33
+
34
+ # --- TE-only encoders (FLAN-T5-XXL FP16 & ViT-L TE-only) ---
35
+ echo ">>> Downloading TE-only encoders -> $CLIP_DIR"
36
+ curl -fL -C - --retry 5 --retry-all-errors \
37
+ "https://huggingface.co/easygoing0114/flan-t5-xxl-fused/resolve/main/flan_t5_xxl_TE-only_FP16.safetensors" \
38
+ -o "$CLIP_DIR/flan_t5_xxl_TE-only_FP16.safetensors"
39
+
40
+ curl -fL -C - --retry 5 --retry-all-errors \
41
+ "https://huggingface.co/zer0int/CLIP-GmP-ViT-L-14/resolve/main/ViT-L-14-TEXT-detail-improved-hiT-GmP-TE-only-HF.safetensors" \
42
+ -o "$CLIP_DIR/vit_l_te_only.safetensors"
43
+
44
+ # --- VAE (официальный через HF_TOKEN или публичный фолбэк) ---
45
+ echo ">>> Downloading VAE -> $VAE_DIR"
46
+ if [[ -n "${HF_TOKEN:-}" ]]; then
47
+ echo ">>> HF_TOKEN present; trying official BFL VAE"
48
+ if curl -fL -C - --retry 5 --retry-all-errors \
49
+ -H "Authorization: Bearer $HF_TOKEN" \
50
+ "https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/ae.safetensors" \
51
+ -o "$VAE_DIR/ae.safetensors"; then
52
+ echo ">>> Official VAE downloaded"
53
+ else
54
+ echo ">>> Official VAE failed; using public mirror"
55
+ curl -fL -C - --retry 5 --retry-all-errors \
56
+ "https://huggingface.co/ffxvs/vae-flux/resolve/main/ae.safetensors" \
57
+ -o "$VAE_DIR/ae.safetensors"
58
+ fi
59
+ else
60
+ echo ">>> No HF_TOKEN; using public mirror VAE"
61
+ curl -fL -C - --retry 5 --retry-all-errors \
62
+ "https://huggingface.co/ffxvs/vae-flux/resolve/main/ae.safetensors" \
63
+ -o "$VAE_DIR/ae.safetensors"
64
+ fi
65
+
66
+ # --- Flux1-dev checkpoint (Comfy-Org, public) ---
67
+ echo ">>> Downloading flux1-dev checkpoint -> $DIFF_DIR"
68
+ curl -fL -C - --retry 5 --retry-all-errors \
69
+ "https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev.safetensors" \
70
+ -o "$DIFF_DIR/flux1-dev.safetensors"
71
+
72
+ # --- ControlNet Union for FLUX.1-dev (InstantX) ---
73
+ # Файлы: diffusion_pytorch_model.safetensors (~6.6 GB) + config.json
74
+ echo ">>> Downloading FLUX ControlNet Union -> $CN_DIR"
75
+ curl -fL -C - --retry 5 --retry-all-errors \
76
+ "https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union/resolve/main/diffusion_pytorch_model.safetensors" \
77
+ -o "$CN_DIR/flux1-dev-controlnet-union.safetensors"
78
+
79
+ curl -fL -C - --retry 5 --retry-all-errors \
80
+ "https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Union/resolve/main/config.json" \
81
+ -o "$CN_DIR/flux1-dev-controlnet-union.json"
82
+
83
+ # --- LoRAs (public) ---
84
+ echo ">>> Downloading LoRAs -> $LORA_DIR"
85
+ for f in Ernie_LoRA_FLUX Ostin_LoRA_FLUX Sheep_LoRA_FLUX; do
86
+ curl -fL -C - --retry 5 --retry-all-errors \
87
+ "https://huggingface.co/playrix/loras/resolve/main/${f}.safetensors" \
88
+ -o "$LORA_DIR/${f}.safetensors"
89
+ done
90
+
91
+ echo ">>> DONE. Models stored under $STORAGE_MODELS and visible via /ComfyUI/models"
92
+ echo ">>> ComfyUI: Reload Models."
93
+ echo ">>> Load Diffusion: models/diffusion_models/flux1-dev.safetensors"
94
+ echo ">>> Load TE-only: models/clip/flan_t5_xxl_TE-only_FP16.safetensors + models/clip/vit_l_te_only.safetensors"
95
+ echo ">>> Load VAE: models/vae/ae.safetensors"
96
+ echo ">>> Load ControlNet: models/controlnet/flux1-dev-controlnet-union.safetensors"