realgen4 commited on
Commit
0afc35c
·
verified ·
1 Parent(s): 4c8983f

Update lipsync.sh

Browse files
Files changed (1) hide show
  1. lipsync.sh +153 -21
lipsync.sh CHANGED
@@ -12,9 +12,15 @@ CUSTOM_NODES_DIR="${COMFYUI_DIR}/custom_nodes"
12
  MODELS_DIR="${COMFYUI_DIR}/models"
13
  WORKFLOWS_DIR="${COMFYUI_DIR}/user/default/workflows"
14
  INPUT_DIR="${COMFYUI_DIR}/input"
 
 
15
 
16
  HF_REPO_BASE="${HF_REPO_BASE:-https://huggingface.co/realgen4/OFMHUB-assets/resolve/main}"
17
- WORKFLOW_JSON_URL="${WORKFLOW_JSON_URL:-${HF_REPO_BASE}/OFM_hubv2_animatorlipsync.json}"
 
 
 
 
18
 
19
  log "Starting animatorlipsync provisioning"
20
 
@@ -31,8 +37,12 @@ if [ ! -d "${COMFYUI_DIR}" ]; then
31
  exit 1
32
  fi
33
 
34
- mkdir -p "${CUSTOM_NODES_DIR}" "${WORKFLOWS_DIR}" "${INPUT_DIR}"
35
  mkdir -p \
 
 
 
 
 
36
  "${MODELS_DIR}/diffusion_models" \
37
  "${MODELS_DIR}/vae" \
38
  "${MODELS_DIR}/text_encoders" \
@@ -40,7 +50,8 @@ mkdir -p \
40
  "${MODELS_DIR}/controlnet" \
41
  "${MODELS_DIR}/loras" \
42
  "${MODELS_DIR}/detection" \
43
- "${MODELS_DIR}/sam2"
 
44
 
45
  apt-get update -y || true
46
  apt-get install -y \
@@ -95,13 +106,32 @@ download_if_missing() {
95
 
96
  mkdir -p "$(dirname "${out}")"
97
  log "Downloading $(basename "${out}")"
98
- wget -O "${out}" --tries=5 --timeout=60 "${url}" || {
99
  warn "Failed download: ${url}"
100
  rm -f "${out}"
101
  return 1
102
  }
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  install_ts_node_from_hf() {
106
  local target_dir="${CUSTOM_NODES_DIR}/NEW-UTILS"
107
 
@@ -137,24 +167,103 @@ install_repo_node "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite" "Com
137
  install_repo_node "https://github.com/rgthree/rgthree-comfy" "rgthree-comfy"
138
  install_repo_node "https://github.com/PGCRT/CRT-Nodes" "CRT-Nodes"
139
  install_repo_node "https://github.com/evanspearman/ComfyMath" "ComfyMath"
 
 
140
  install_ts_node_from_hf
141
 
142
- log "Downloading workflow"
143
- download_if_missing "${WORKFLOW_JSON_URL}" "${WORKFLOWS_DIR}/OFM_hubv2_animatorlipsync.json" || warn "Workflow download failed"
144
-
145
- log "Downloading models"
146
- download_if_missing "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/Wan22Animate/Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors" "${MODELS_DIR}/diffusion_models/Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors" || true
147
- download_if_missing "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors" "${MODELS_DIR}/vae/wan_2.1_vae.safetensors" || true
148
- download_if_missing "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" "${MODELS_DIR}/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" || true
149
- download_if_missing "https://huggingface.co/calcuis/wan-gguf/resolve/f52f5a1f0ba441d50277fb7cdd7c1b36611837f9/clip_vision_h.safetensors" "${MODELS_DIR}/clip_vision/clip_vision_h.safetensors" || true
150
- download_if_missing "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan21_Uni3C_controlnet_fp16.safetensors" "${MODELS_DIR}/controlnet/Wan21_Uni3C_controlnet_fp16.safetensors" || true
151
- download_if_missing "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Lightx2v/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors" "${MODELS_DIR}/loras/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors" || true
152
- download_if_missing "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" "${MODELS_DIR}/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" || true
153
- download_if_missing "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Pusa/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" "${MODELS_DIR}/loras/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" || true
154
- download_if_missing "https://huggingface.co/rahul7star/wan2.2Lora/resolve/main/Wan2.2-Fun-A14B-InP-low-noise-HPS2.1.safetensors" "${MODELS_DIR}/loras/Wan2.2-Fun-A14B-InP-low-noise-HPS2.1.safetensors" || true
155
- download_if_missing "https://huggingface.co/JunkyByte/easy_ViTPose/resolve/main/onnx/wholebody/vitpose-l-wholebody.onnx" "${MODELS_DIR}/detection/vitpose-l-wholebody.onnx" || true
156
- download_if_missing "https://huggingface.co/onnx-community/yolov10m/resolve/main/onnx/model.onnx" "${MODELS_DIR}/detection/yolov10m.onnx" || true
157
- download_if_missing "https://huggingface.co/Kijai/sam2-safetensors/resolve/main/sam2.1_hiera_base_plus.safetensors" "${MODELS_DIR}/sam2/sam2.1_hiera_base_plus.safetensors" || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
 
159
  log "Validation"
160
  missing=0
@@ -167,6 +276,8 @@ for path in \
167
  "${CUSTOM_NODES_DIR}/rgthree-comfy" \
168
  "${CUSTOM_NODES_DIR}/CRT-Nodes" \
169
  "${CUSTOM_NODES_DIR}/ComfyMath" \
 
 
170
  "${CUSTOM_NODES_DIR}/NEW-UTILS/__init__.py" \
171
  "${CUSTOM_NODES_DIR}/NEW-UTILS/nodes/color_match.py" \
172
  "${CUSTOM_NODES_DIR}/NEW-UTILS/nodes/openpose_smoother.py" \
@@ -180,11 +291,15 @@ for path in \
180
  "${MODELS_DIR}/loras/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors" \
181
  "${MODELS_DIR}/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" \
182
  "${MODELS_DIR}/loras/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" \
 
183
  "${MODELS_DIR}/loras/Wan2.2-Fun-A14B-InP-low-noise-HPS2.1.safetensors" \
184
  "${MODELS_DIR}/detection/vitpose-l-wholebody.onnx" \
185
  "${MODELS_DIR}/detection/yolov10m.onnx" \
186
  "${MODELS_DIR}/sam2/sam2.1_hiera_base_plus.safetensors" \
187
- "${WORKFLOWS_DIR}/OFM_hubv2_animatorlipsync.json"
 
 
 
188
  do
189
  if [ -e "${path}" ]; then
190
  log "OK: ${path}"
@@ -194,6 +309,23 @@ do
194
  fi
195
  done
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  if [ "${missing}" -eq 1 ]; then
198
  warn "Provisioning completed with missing files"
199
  else
 
12
  MODELS_DIR="${COMFYUI_DIR}/models"
13
  WORKFLOWS_DIR="${COMFYUI_DIR}/user/default/workflows"
14
  INPUT_DIR="${COMFYUI_DIR}/input"
15
+ OUTPUT_DIR="${COMFYUI_DIR}/output"
16
+ TEMP_DIR="${COMFYUI_DIR}/temp"
17
 
18
  HF_REPO_BASE="${HF_REPO_BASE:-https://huggingface.co/realgen4/OFMHUB-assets/resolve/main}"
19
+ WORKFLOW_JSON_URL="${WORKFLOW_JSON_URL:-}"
20
+ WORKFLOW_JSON_NAME="${WORKFLOW_JSON_NAME:-ЛипсинкФикшенный.json}"
21
+
22
+ # Optional: preseed RIFE model. If this download fails, ComfyUI-VFI can still auto-download it on first use.
23
+ RIFE_FLOWNET_URL="${RIFE_FLOWNET_URL:-https://huggingface.co/jbilcke-hf/varnish/resolve/main/rife/flownet.pkl}"
24
 
25
  log "Starting animatorlipsync provisioning"
26
 
 
37
  exit 1
38
  fi
39
 
 
40
  mkdir -p \
41
+ "${CUSTOM_NODES_DIR}" \
42
+ "${WORKFLOWS_DIR}" \
43
+ "${INPUT_DIR}" \
44
+ "${OUTPUT_DIR}" \
45
+ "${TEMP_DIR}" \
46
  "${MODELS_DIR}/diffusion_models" \
47
  "${MODELS_DIR}/vae" \
48
  "${MODELS_DIR}/text_encoders" \
 
50
  "${MODELS_DIR}/controlnet" \
51
  "${MODELS_DIR}/loras" \
52
  "${MODELS_DIR}/detection" \
53
+ "${MODELS_DIR}/sam2" \
54
+ "${MODELS_DIR}/rife"
55
 
56
  apt-get update -y || true
57
  apt-get install -y \
 
106
 
107
  mkdir -p "$(dirname "${out}")"
108
  log "Downloading $(basename "${out}")"
109
+ wget -O "${out}" --tries=5 --timeout=120 "${url}" || {
110
  warn "Failed download: ${url}"
111
  rm -f "${out}"
112
  return 1
113
  }
114
  }
115
 
116
+ copy_if_missing() {
117
+ local src="$1"
118
+ local dst="$2"
119
+
120
+ if [ ! -f "${src}" ]; then
121
+ warn "copy_if_missing source missing: ${src}"
122
+ return 1
123
+ fi
124
+
125
+ if [ -f "${dst}" ]; then
126
+ log "Exists: ${dst}"
127
+ return 0
128
+ fi
129
+
130
+ mkdir -p "$(dirname "${dst}")"
131
+ cp -f "${src}" "${dst}"
132
+ log "Copied alias $(basename "${src}") -> ${dst}"
133
+ }
134
+
135
  install_ts_node_from_hf() {
136
  local target_dir="${CUSTOM_NODES_DIR}/NEW-UTILS"
137
 
 
167
  install_repo_node "https://github.com/rgthree/rgthree-comfy" "rgthree-comfy"
168
  install_repo_node "https://github.com/PGCRT/CRT-Nodes" "CRT-Nodes"
169
  install_repo_node "https://github.com/evanspearman/ComfyMath" "ComfyMath"
170
+ install_repo_node "https://github.com/GACLove/ComfyUI-VFI" "ComfyUI-VFI"
171
+ install_repo_node "https://github.com/Fannovel16/comfyui_controlnet_aux" "comfyui_controlnet_aux"
172
  install_ts_node_from_hf
173
 
174
+ if [ -n "${WORKFLOW_JSON_URL}" ]; then
175
+ log "Downloading workflow"
176
+ download_if_missing "${WORKFLOW_JSON_URL}" "${WORKFLOWS_DIR}/${WORKFLOW_JSON_NAME}" || warn "Workflow download failed"
177
+ else
178
+ warn "WORKFLOW_JSON_URL is empty, skipping workflow download. Put your JSON manually into ${WORKFLOWS_DIR}"
179
+ fi
180
+
181
+ log "Downloading models used by the workflow"
182
+ # Wan model stack
183
+
184
+ download_if_missing \
185
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/Wan22Animate/Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors" \
186
+ "${MODELS_DIR}/diffusion_models/Wan2_2-Animate-14B_fp8_scaled_e4m3fn_KJ_v2.safetensors" || true
187
+
188
+ download_if_missing \
189
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors" \
190
+ "${MODELS_DIR}/vae/wan_2.1_vae.safetensors" || true
191
+
192
+ download_if_missing \
193
+ "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" \
194
+ "${MODELS_DIR}/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" || true
195
+
196
+ download_if_missing \
197
+ "https://huggingface.co/calcuis/wan-gguf/resolve/f52f5a1f0ba441d50277fb7cdd7c1b36611837f9/clip_vision_h.safetensors" \
198
+ "${MODELS_DIR}/clip_vision/clip_vision_h.safetensors" || true
199
+
200
+ download_if_missing \
201
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan21_Uni3C_controlnet_fp16.safetensors" \
202
+ "${MODELS_DIR}/controlnet/Wan21_Uni3C_controlnet_fp16.safetensors" || true
203
+
204
+ download_if_missing \
205
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Lightx2v/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors" \
206
+ "${MODELS_DIR}/loras/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors" || true
207
+
208
+ download_if_missing \
209
+ "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" \
210
+ "${MODELS_DIR}/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" || true
211
+
212
+ download_if_missing \
213
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Pusa/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" \
214
+ "${MODELS_DIR}/loras/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" || true
215
+ # Exact filename alias for your JSON (LoRA vs LORA case difference)
216
+ copy_if_missing \
217
+ "${MODELS_DIR}/loras/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" \
218
+ "${MODELS_DIR}/loras/Wan21_PusaV1_LoRA_14B_rank512_bf16.safetensors" || true
219
+
220
+ download_if_missing \
221
+ "https://huggingface.co/rahul7star/wan2.2Lora/resolve/main/Wan2.2-Fun-A14B-InP-low-noise-HPS2.1.safetensors" \
222
+ "${MODELS_DIR}/loras/Wan2.2-Fun-A14B-InP-low-noise-HPS2.1.safetensors" || true
223
+
224
+ # WanAnimatePreprocess models -> ComfyUI/models/detection
225
+
226
+ download_if_missing \
227
+ "https://huggingface.co/JunkyByte/easy_ViTPose/resolve/main/onnx/wholebody/vitpose-l-wholebody.onnx" \
228
+ "${MODELS_DIR}/detection/vitpose-l-wholebody.onnx" || true
229
+
230
+ download_if_missing \
231
+ "https://huggingface.co/onnx-community/yolov10m/resolve/main/onnx/model.onnx" \
232
+ "${MODELS_DIR}/detection/yolov10m.onnx" || true
233
+
234
+ # SAM2
235
+
236
+ download_if_missing \
237
+ "https://huggingface.co/Kijai/sam2-safetensors/resolve/main/sam2.1_hiera_base_plus.safetensors" \
238
+ "${MODELS_DIR}/sam2/sam2.1_hiera_base_plus.safetensors" || true
239
+
240
+ # DWPose models for DWPreprocessor -> comfyui_controlnet_aux expected cache paths
241
+ DWPOSE_DIR_YZD="${CUSTOM_NODES_DIR}/comfyui_controlnet_aux/ckpts/yzd-v/DWPose"
242
+ DWPOSE_DIR_HR16="${CUSTOM_NODES_DIR}/comfyui_controlnet_aux/ckpts/hr16/UnJIT-DWPose"
243
+ mkdir -p "${DWPOSE_DIR_YZD}" "${DWPOSE_DIR_HR16}"
244
+
245
+ download_if_missing \
246
+ "https://huggingface.co/yzd-v/DWPose/resolve/main/yolox_l.onnx" \
247
+ "${DWPOSE_DIR_YZD}/yolox_l.onnx" || true
248
+
249
+ download_if_missing \
250
+ "https://huggingface.co/yzd-v/DWPose/resolve/main/dw-ll_ucoco_384.onnx" \
251
+ "${DWPOSE_DIR_YZD}/dw-ll_ucoco_384.onnx" || true
252
+
253
+ # Exact filename alias for your JSON widget value: dw-ll_ucoco.onnx
254
+ copy_if_missing \
255
+ "${DWPOSE_DIR_YZD}/dw-ll_ucoco_384.onnx" \
256
+ "${DWPOSE_DIR_YZD}/dw-ll_ucoco.onnx" || true
257
+ # Extra compatibility alias for wrappers that look in hr16/UnJIT-DWPose
258
+ copy_if_missing \
259
+ "${DWPOSE_DIR_YZD}/dw-ll_ucoco_384.onnx" \
260
+ "${DWPOSE_DIR_HR16}/dw-ll_ucoco.onnx" || true
261
+
262
+ # RIFE model for RIFEInterpolation -> ComfyUI/models/rife/flownet.pkl
263
+ # If this fails, ComfyUI-VFI can auto-download it on first use.
264
+ download_if_missing \
265
+ "${RIFE_FLOWNET_URL}" \
266
+ "${MODELS_DIR}/rife/flownet.pkl" || true
267
 
268
  log "Validation"
269
  missing=0
 
276
  "${CUSTOM_NODES_DIR}/rgthree-comfy" \
277
  "${CUSTOM_NODES_DIR}/CRT-Nodes" \
278
  "${CUSTOM_NODES_DIR}/ComfyMath" \
279
+ "${CUSTOM_NODES_DIR}/ComfyUI-VFI" \
280
+ "${CUSTOM_NODES_DIR}/comfyui_controlnet_aux" \
281
  "${CUSTOM_NODES_DIR}/NEW-UTILS/__init__.py" \
282
  "${CUSTOM_NODES_DIR}/NEW-UTILS/nodes/color_match.py" \
283
  "${CUSTOM_NODES_DIR}/NEW-UTILS/nodes/openpose_smoother.py" \
 
291
  "${MODELS_DIR}/loras/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors" \
292
  "${MODELS_DIR}/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" \
293
  "${MODELS_DIR}/loras/Wan21_PusaV1_LORA_14B_rank512_bf16.safetensors" \
294
+ "${MODELS_DIR}/loras/Wan21_PusaV1_LoRA_14B_rank512_bf16.safetensors" \
295
  "${MODELS_DIR}/loras/Wan2.2-Fun-A14B-InP-low-noise-HPS2.1.safetensors" \
296
  "${MODELS_DIR}/detection/vitpose-l-wholebody.onnx" \
297
  "${MODELS_DIR}/detection/yolov10m.onnx" \
298
  "${MODELS_DIR}/sam2/sam2.1_hiera_base_plus.safetensors" \
299
+ "${DWPOSE_DIR_YZD}/yolox_l.onnx" \
300
+ "${DWPOSE_DIR_YZD}/dw-ll_ucoco_384.onnx" \
301
+ "${DWPOSE_DIR_YZD}/dw-ll_ucoco.onnx" \
302
+ "${DWPOSE_DIR_HR16}/dw-ll_ucoco.onnx"
303
  do
304
  if [ -e "${path}" ]; then
305
  log "OK: ${path}"
 
309
  fi
310
  done
311
 
312
+ if [ -n "${WORKFLOW_JSON_URL}" ]; then
313
+ if [ -e "${WORKFLOWS_DIR}/${WORKFLOW_JSON_NAME}" ]; then
314
+ log "OK: ${WORKFLOWS_DIR}/${WORKFLOW_JSON_NAME}"
315
+ else
316
+ warn "MISSING: ${WORKFLOWS_DIR}/${WORKFLOW_JSON_NAME}"
317
+ missing=1
318
+ fi
319
+ else
320
+ warn "Workflow file was not validated because WORKFLOW_JSON_URL is empty"
321
+ fi
322
+
323
+ if [ -e "${MODELS_DIR}/rife/flownet.pkl" ]; then
324
+ log "OK: ${MODELS_DIR}/rife/flownet.pkl"
325
+ else
326
+ warn "RIFE flownet.pkl not preloaded. ComfyUI-VFI should auto-download it on first use."
327
+ fi
328
+
329
  if [ "${missing}" -eq 1 ]; then
330
  warn "Provisioning completed with missing files"
331
  else