Upload default.sh
Browse files- default.sh +216 -0
default.sh
ADDED
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# This file will be sourced in init.sh
|
4 |
+
|
5 |
+
# https://raw.githubusercontent.com/ai-dock/comfyui/main/config/provisioning/default.sh
|
6 |
+
|
7 |
+
# Packages are installed after nodes so we can fix them...
|
8 |
+
|
9 |
+
PYTHON_PACKAGES=(
|
10 |
+
#"opencv-python==4.7.0.72"
|
11 |
+
)
|
12 |
+
|
13 |
+
NODES=(
|
14 |
+
"https://github.com/ltdrdata/ComfyUI-Manager"
|
15 |
+
"https://github.com/WASasquatch/was-node-suite-comfyui"
|
16 |
+
"https://github.com/cubiq/ComfyUI_essentials"
|
17 |
+
"https://github.com/ltdrdata/ComfyUI-Impact-Pack"
|
18 |
+
"https://github.com/Fannovel16/comfyui_controlnet_aux"
|
19 |
+
"https://github.com/Gourieff/comfyui-reactor-node"
|
20 |
+
"https://github.com/cubiq/ComfyUI_InstantID"
|
21 |
+
"https://github.com/cubiq/ComfyUI_IPAdapter_plus"
|
22 |
+
)
|
23 |
+
|
24 |
+
CHECKPOINT_MODELS=(
|
25 |
+
"https://huggingface.co/Lykon/dreamshaper-xl-lightning/resolve/main/DreamShaperXL_Lightning.safetensors"
|
26 |
+
)
|
27 |
+
|
28 |
+
LORA_MODELS=(
|
29 |
+
)
|
30 |
+
|
31 |
+
VAE_MODELS=(
|
32 |
+
)
|
33 |
+
|
34 |
+
ESRGAN_MODELS=(
|
35 |
+
)
|
36 |
+
|
37 |
+
CONTROLNET_MODELS=(
|
38 |
+
"https://huggingface.co/InstantX/InstantID/resolve/main/ControlNetModel/diffusion_pytorch_model.safetensors"
|
39 |
+
"https://huggingface.co/Kuvshin/models/resolve/main/pose_sdxl.safetensors"
|
40 |
+
)
|
41 |
+
|
42 |
+
INSIGHTFACE=(
|
43 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/inswapper_128.onnx"
|
44 |
+
)
|
45 |
+
|
46 |
+
BUFALO=(
|
47 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/buffalo_l/1k3d68.onnx"
|
48 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/buffalo_l/2d106det.onnx"
|
49 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/buffalo_l/det_10g.onnx"
|
50 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/buffalo_l/genderage.onnx"
|
51 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/buffalo_l/w600k_r50.onnx"
|
52 |
+
)
|
53 |
+
|
54 |
+
ANTELOPEV=(
|
55 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/antelopev2/1k3d68.onnx"
|
56 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/antelopev2/2d106det.onnx"
|
57 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/antelopev2/genderage.onnx"
|
58 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/antelopev2/glintr100.onnx"
|
59 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/insightface/models/antelopev2/scrfd_10g_bnkps.onnx"
|
60 |
+
)
|
61 |
+
|
62 |
+
BBOX=(
|
63 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/ultralytics/bbox/face_yolov8m.pt"
|
64 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/ultralytics/bbox/hand_yolov8s.pt"
|
65 |
+
)
|
66 |
+
|
67 |
+
SEGM=(
|
68 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/ultralytics/segm/person_yolov8m-seg.pt"
|
69 |
+
)
|
70 |
+
|
71 |
+
SAMS=(
|
72 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/sam_vit_b_01ec64.pth"
|
73 |
+
)
|
74 |
+
|
75 |
+
CLIP=(
|
76 |
+
"https://huggingface.co/Kuvshin/models/resolve/main/CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors"
|
77 |
+
)
|
78 |
+
|
79 |
+
FACEDETECTION=(
|
80 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/detection_Resnet50_Final.pth"
|
81 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/parsing_parsenet.pth"
|
82 |
+
)
|
83 |
+
|
84 |
+
FACERESTORE=(
|
85 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/GFPGANv1.3.pth"
|
86 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/GFPGANv1.4.pth"
|
87 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/GPEN-BFR-512.onnx"
|
88 |
+
"https://huggingface.co/Kuvshin/kuvshin8/resolve/main/codeformer-v0.1.0.pth"
|
89 |
+
)
|
90 |
+
|
91 |
+
INSTANTID=(
|
92 |
+
"https://huggingface.co/InstantX/InstantID/resolve/main/ip-adapter.bin"
|
93 |
+
)
|
94 |
+
### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
|
95 |
+
|
96 |
+
function provisioning_start() {
|
97 |
+
DISK_GB_AVAILABLE=$(($(df --output=avail -m "${WORKSPACE}" | tail -n1) / 1000))
|
98 |
+
DISK_GB_USED=$(($(df --output=used -m "${WORKSPACE}" | tail -n1) / 1000))
|
99 |
+
DISK_GB_ALLOCATED=$(($DISK_GB_AVAILABLE + $DISK_GB_USED))
|
100 |
+
provisioning_print_header
|
101 |
+
provisioning_get_nodes
|
102 |
+
provisioning_install_python_packages
|
103 |
+
provisioning_get_models \
|
104 |
+
"${WORKSPACE}/storage/stable_diffusion/models/ckpt" \
|
105 |
+
"${CHECKPOINT_MODELS[@]}"
|
106 |
+
provisioning_get_models \
|
107 |
+
"${WORKSPACE}/storage/stable_diffusion/models/lora" \
|
108 |
+
"${LORA_MODELS[@]}"
|
109 |
+
provisioning_get_models \
|
110 |
+
"${WORKSPACE}/storage/stable_diffusion/models/controlnet" \
|
111 |
+
"${CONTROLNET_MODELS[@]}"
|
112 |
+
provisioning_get_models \
|
113 |
+
"${WORKSPACE}/storage/stable_diffusion/models/vae" \
|
114 |
+
"${VAE_MODELS[@]}"
|
115 |
+
provisioning_get_models \
|
116 |
+
"${WORKSPACE}/storage/stable_diffusion/models/esrgan" \
|
117 |
+
"${ESRGAN_MODELS[@]}"
|
118 |
+
provisioning_get_models \
|
119 |
+
"${WORKSPACE}/storage/stable_diffusion/models/insightface" \
|
120 |
+
"${INSIGHTFACE[@]}"
|
121 |
+
provisioning_get_models \
|
122 |
+
"${WORKSPACE}/storage/stable_diffusion/models/insightface/models/buffalo_l" \
|
123 |
+
"${BUFALO[@]}"
|
124 |
+
provisioning_get_models \
|
125 |
+
"${WORKSPACE}/storage/stable_diffusion/models/insightface/models/antelopev2" \
|
126 |
+
"${ANTELOPEV[@]}"
|
127 |
+
provisioning_get_models \
|
128 |
+
"${WORKSPACE}/storage/stable_diffusion/models/ultralytics/bbox" \
|
129 |
+
"${BBOX[@]}"
|
130 |
+
provisioning_get_models \
|
131 |
+
"${WORKSPACE}/storage/stable_diffusion/models/ultralytics/segm" \
|
132 |
+
"${SEGM[@]}"
|
133 |
+
provisioning_get_models \
|
134 |
+
"${WORKSPACE}/storage/stable_diffusion/models/sams" \
|
135 |
+
"${SAMS[@]}"
|
136 |
+
provisioning_get_models \
|
137 |
+
"${WORKSPACE}/storage/stable_diffusion/models/clip_vision" \
|
138 |
+
"${CLIP[@]}"
|
139 |
+
provisioning_get_models \
|
140 |
+
"${WORKSPACE}/storage/stable_diffusion/models/facedetection" \
|
141 |
+
"${FACEDETECTION[@]}"
|
142 |
+
provisioning_get_models \
|
143 |
+
"${WORKSPACE}/storage/stable_diffusion/models/facerestore_models" \
|
144 |
+
"${FACERESTORE[@]}"
|
145 |
+
provisioning_get_models \
|
146 |
+
"${WORKSPACE}/storage/stable_diffusion/models/instantid" \
|
147 |
+
"${INSTANTID[@]}"
|
148 |
+
provisioning_print_end
|
149 |
+
}
|
150 |
+
|
151 |
+
function provisioning_get_nodes() {
|
152 |
+
for repo in "${NODES[@]}"; do
|
153 |
+
dir="${repo##*/}"
|
154 |
+
path="/opt/ComfyUI/custom_nodes/${dir}"
|
155 |
+
requirements="${path}/requirements.txt"
|
156 |
+
if [[ -d $path ]]; then
|
157 |
+
if [[ ${AUTO_UPDATE,,} != "false" ]]; then
|
158 |
+
printf "Updating node: %s...\n" "${repo}"
|
159 |
+
( cd "$path" && git pull )
|
160 |
+
if [[ -e $requirements ]]; then
|
161 |
+
micromamba -n comfyui run ${PIP_INSTALL} -r "$requirements"
|
162 |
+
fi
|
163 |
+
fi
|
164 |
+
else
|
165 |
+
printf "Downloading node: %s...\n" "${repo}"
|
166 |
+
git clone "${repo}" "${path}" --recursive
|
167 |
+
if [[ -e $requirements ]]; then
|
168 |
+
micromamba -n comfyui run ${PIP_INSTALL} -r "${requirements}"
|
169 |
+
fi
|
170 |
+
fi
|
171 |
+
done
|
172 |
+
}
|
173 |
+
|
174 |
+
function provisioning_install_python_packages() {
|
175 |
+
if [ ${#PYTHON_PACKAGES[@]} -gt 0 ]; then
|
176 |
+
micromamba -n comfyui run ${PIP_INSTALL} ${PYTHON_PACKAGES[*]}
|
177 |
+
fi
|
178 |
+
}
|
179 |
+
|
180 |
+
function provisioning_get_models() {
|
181 |
+
if [[ -z $2 ]]; then return 1; fi
|
182 |
+
dir="$1"
|
183 |
+
mkdir -p "$dir"
|
184 |
+
shift
|
185 |
+
if [[ $DISK_GB_ALLOCATED -ge $DISK_GB_REQUIRED ]]; then
|
186 |
+
arr=("$@")
|
187 |
+
else
|
188 |
+
printf "WARNING: Low disk space allocation - Only the first model will be downloaded!\n"
|
189 |
+
arr=("$1")
|
190 |
+
fi
|
191 |
+
|
192 |
+
printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
|
193 |
+
for url in "${arr[@]}"; do
|
194 |
+
printf "Downloading: %s\n" "${url}"
|
195 |
+
provisioning_download "${url}" "${dir}"
|
196 |
+
printf "\n"
|
197 |
+
done
|
198 |
+
}
|
199 |
+
|
200 |
+
function provisioning_print_header() {
|
201 |
+
printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n"
|
202 |
+
if [[ $DISK_GB_ALLOCATED -lt $DISK_GB_REQUIRED ]]; then
|
203 |
+
printf "WARNING: Your allocated disk size (%sGB) is below the recommended %sGB - Some models will not be downloaded\n" "$DISK_GB_ALLOCATED" "$DISK_GB_REQUIRED"
|
204 |
+
fi
|
205 |
+
}
|
206 |
+
|
207 |
+
function provisioning_print_end() {
|
208 |
+
printf "\nProvisioning complete: Web UI will start now\n\n"
|
209 |
+
}
|
210 |
+
|
211 |
+
# Download from $1 URL to $2 file path
|
212 |
+
function provisioning_download() {
|
213 |
+
wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
|
214 |
+
}
|
215 |
+
|
216 |
+
provisioning_start
|