stabletable25 commited on
Commit
75db9a9
·
verified ·
1 Parent(s): b0fdc33

Update installcomfyv2.sh

Browse files
Files changed (1) hide show
  1. installcomfyv2.sh +95 -0
installcomfyv2.sh CHANGED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cd /workspace/madapps
2
+ cat > install_comfyui.sh << 'EOF'
3
+ #!/usr/bin/env bash
4
+ #!/usr/bin/env bash
5
+ # ---------------------------------------------------------------------------
6
+ # ComfyUI one‑shot installer for RunPod (rev‑2)
7
+ # ---------------------------------------------------------------------------
8
+ # • Activates your virtualenv
9
+ # • Installs official **system** CMake & tool‑chain first (avoids dlib build bug)
10
+ # • Removes any pip‑provided cmake that might shadow /usr/bin/cmake
11
+ # • Installs Python deps and downloads model weights (idempotent)
12
+ # ---------------------------------------------------------------------------
13
+ set -euo pipefail
14
+ COMFY_DIR="${COMFY_DIR:-/workspace/madapps/ComfyUI}"
15
+ VENV="${VENV:-$COMFY_DIR/.venv}"
16
+ info() { echo -e "\033[1;32m[INFO]\033[0m $*"; }
17
+ warn() { echo -e "\033[1;33m[WARN]\033[0m $*"; }
18
+ # ---------------------------------------------------------------------------
19
+ # Sanity checks
20
+ # ---------------------------------------------------------------------------
21
+ if [[ ! -d "$COMFY_DIR" ]]; then
22
+ warn "ComfyUI directory '$COMFY_DIR' does not exist. Set COMFY_DIR or clone ComfyUI first."; exit 1; fi
23
+ if [[ ! -d "$VENV" ]]; then
24
+ warn "Python venv '$VENV' not found. Create it with 'python -m venv $VENV' first."; exit 1; fi
25
+ # ---------------------------------------------------------------------------
26
+ # Activate env & upgrade pip
27
+ # ---------------------------------------------------------------------------
28
+ info "Activating virtualenv…"; source "$VENV/bin/activate"
29
+ info "Upgrading pip & wheel…"; pip install --upgrade pip wheel
30
+ # ---------------------------------------------------------------------------
31
+ # System build deps **first** so dlib finds a real /usr/bin/cmake
32
+ # ---------------------------------------------------------------------------
33
+ APT_CMD="apt-get"; [[ $(id -u) -ne 0 && $(command -v sudo) ]] && APT_CMD="sudo $APT_CMD"
34
+ if [[ -n "$APT_CMD" ]]; then
35
+ info "Installing system CMake & tool‑chain…"
36
+ $APT_CMD update -y && $APT_CMD install -y cmake build-essential python3-dev git wget
37
+ fi
38
+ # ---------------------------------------------------------------------------
39
+ # Ensure pip’s cmake, if present, doesn’t shadow the system one
40
+ # ---------------------------------------------------------------------------
41
+ if pip show cmake >/dev/null 2>&1; then
42
+ warn "Removing pip‑installed cmake to avoid conflicts…"; pip uninstall -y cmake; fi
43
+ # ---------------------------------------------------------------------------
44
+ # Python packages that need the compiler tool‑chain
45
+ # ---------------------------------------------------------------------------
46
+ info "Installing Python deps (dlib, insightface)…"
47
+ pip install --no-cache-dir dlib insightface
48
+ info "Pinning transformers==4.52…"
49
+ if pip show transformers >/dev/null 2>&1; then pip uninstall -y transformers; fi
50
+ pip install --no-cache-dir transformers==4.52
51
+ # ---------------------------------------------------------------------------
52
+ # Helper for idempotent downloads
53
+ # ---------------------------------------------------------------------------
54
+ download() {
55
+ local url="$1" dst="$2";
56
+ if [[ -f "$dst" ]]; then info "✓ $(basename "$dst") already exists"; else
57
+ info "↓ $(basename "$dst")"; wget -q --show-progress -O "$dst" "$url"; fi }
58
+ # Create dirs
59
+ mkdir -p "$COMFY_DIR/models/"{checkpoints,unet,clip,vae,loras,controlnet}
60
+ # ---------------------------------------------------------------------------
61
+ # Model weights
62
+ # ---------------------------------------------------------------------------
63
+ info "Downloading model weights (skip if already present)…"
64
+ # Checkpoint
65
+ download "https://huggingface.co/stabletable25/lustifyxl/resolve/main/lustifySDXLNSFW_oltFIXEDTEXTURES.safetensors?download=true" \
66
+ "$COMFY_DIR/models/checkpoints/lustifySDXLNSFW_oltFIXEDTEXTURES.safetensors"
67
+ # UNet
68
+ download "https://huggingface.co/stabletable25/lustifyxl/resolve/main/flux1-dev-fp8.safetensors?download=true" \
69
+ "$COMFY_DIR/models/unet/flux1-dev-fp8.safetensors"
70
+ download "https://huggingface.co/6chan/flux1-kontext-dev-fp8/resolve/main/flux1-kontext-dev-fp8-e4m3fn.safetensors?download=true" \
71
+ "$COMFY_DIR/models/unet/flux1-kontext-dev-fp8-e4m3fn.safetensors"
72
+ download "https://huggingface.co/stabletable25/lustifyxl/resolve/main/realDream_flux1V1.safetensors?download=true" \
73
+ "$COMFY_DIR/models/unet/realDream_flux1V1.safetensors"
74
+ # CLIP
75
+ download "https://huggingface.co/GraydientPlatformAPI/flux-clip/resolve/main/clip_l.safetensors?download=true" \
76
+ "$COMFY_DIR/models/clip/clip_l.safetensors"
77
+ download "https://huggingface.co/GraydientPlatformAPI/flux-clip/resolve/main/t5xxl_fp8_e4m3fn.safetensors?download=true" \
78
+ "$COMFY_DIR/models/clip/t5xxl_fp8_e4m3fn.safetensors"
79
+ # VAE
80
+ download "https://huggingface.co/stabletable25/lustifyxl/resolve/main/ae.safetensors?download=true" \
81
+ "$COMFY_DIR/models/vae/ae.safetensors"
82
+ # Lora
83
+ download "https://huggingface.co/XLabs-AI/flux-RealismLora/resolve/main/lora.safetensors?download=true" \
84
+ "$COMFY_DIR/models/loras/flux-RealismLora.safetensors"
85
+ download "https://huggingface.co/stabletable25/lustifyxl/resolve/main/MysticXXX-v7.safetensors?download=true" \
86
+ "$COMFY_DIR/models/loras/MysticXXX-v7.safetensors"
87
+ # ControlNet
88
+ download "https://huggingface.co/jasperai/Flux.1-dev-Controlnet-Depth/resolve/main/diffusion_pytorch_model.safetensors?download=true" \
89
+ "$COMFY_DIR/models/controlnet/jasparaidepth.safetensors"
90
+ download "https://huggingface.co/Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro-2.0/resolve/main/diffusion_pytorch_model.safetensors?download=true" \
91
+ "$COMFY_DIR/models/controlnet/controlnetunionpro2.safetensors"
92
+ # ---------------------------------------------------------------------------
93
+ info "✔ Setup finished. Launch ComfyUI with:\n cd $COMFY_DIR && bash run.sh"
94
+ EOF
95
+ chmod +x install_comfyui.sh