Update setup_comfy_wan222.sh
Browse files- setup_comfy_wan222.sh +50 -21
setup_comfy_wan222.sh
CHANGED
|
@@ -279,19 +279,31 @@ process_downloads() {
|
|
| 279 |
clone_or_update() {
|
| 280 |
local url="$1"
|
| 281 |
local dest="$2"
|
|
|
|
| 282 |
|
|
|
|
| 283 |
if [ -d "$dest/.git" ]; then
|
| 284 |
-
log_info "Atualizando $
|
| 285 |
-
git -C "$dest" pull --ff-only 2>/dev/null ||
|
|
|
|
|
|
|
|
|
|
| 286 |
else
|
| 287 |
-
log_info "Clonando $
|
| 288 |
-
git clone --recursive --depth 1 "$url" "$dest" 2>/dev/null ||
|
|
|
|
|
|
|
|
|
|
| 289 |
fi
|
| 290 |
|
| 291 |
-
# Instalar requirements se existir
|
| 292 |
if [ -f "$dest/requirements.txt" ]; then
|
| 293 |
-
python3 -m pip install --no-warn-script-location -q -r "$dest/requirements.txt" 2>/dev/null ||
|
|
|
|
|
|
|
| 294 |
fi
|
|
|
|
|
|
|
| 295 |
}
|
| 296 |
|
| 297 |
# -----------------------------
|
|
@@ -349,22 +361,28 @@ else
|
|
| 349 |
fi
|
| 350 |
log_success "ComfyUI instalado em: $COMFY_DIR"
|
| 351 |
|
| 352 |
-
# [4] Instalar SageAttention
|
| 353 |
log_info "[4/7] Instalando SageAttention..."
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
|
|
|
|
|
|
| 360 |
cd "$SAGE_DIR"
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
| 362 |
log_success "SageAttention instalado"
|
| 363 |
else
|
| 364 |
-
log_warn "
|
| 365 |
fi
|
| 366 |
-
|
| 367 |
-
|
|
|
|
| 368 |
|
| 369 |
# [5] Baixar modelos
|
| 370 |
log_info "[5/7] Baixando modelos..."
|
|
@@ -389,17 +407,28 @@ log_info "[6/7] Instalando custom nodes..."
|
|
| 389 |
CN_DIR="$COMFY_DIR/custom_nodes"
|
| 390 |
mkdir -p "$CN_DIR"
|
| 391 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
for repo_url in "${CUSTOM_NODES[@]}"; do
|
| 393 |
node_name=$(basename "$repo_url")
|
| 394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
done
|
|
|
|
|
|
|
| 396 |
wait
|
| 397 |
|
| 398 |
log_success "Custom nodes instalados"
|
| 399 |
|
| 400 |
-
# Aguardar SageAttention
|
| 401 |
-
wait $SAGE_PID 2>/dev/null || true
|
| 402 |
-
|
| 403 |
# [7] Verificação final
|
| 404 |
echo ""
|
| 405 |
log_info "[7/7] Verificando instalação..."
|
|
|
|
| 279 |
clone_or_update() {
|
| 280 |
local url="$1"
|
| 281 |
local dest="$2"
|
| 282 |
+
local node_name=$(basename "$dest")
|
| 283 |
|
| 284 |
+
# Timeout de 60 segundos para operações git
|
| 285 |
if [ -d "$dest/.git" ]; then
|
| 286 |
+
log_info "Atualizando $node_name..."
|
| 287 |
+
timeout 60 git -C "$dest" pull --ff-only 2>/dev/null || {
|
| 288 |
+
log_warn "Timeout ou erro ao atualizar $node_name"
|
| 289 |
+
return 0 # Não falhar, apenas avisar
|
| 290 |
+
}
|
| 291 |
else
|
| 292 |
+
log_info "Clonando $node_name..."
|
| 293 |
+
timeout 60 git clone --recursive --depth 1 "$url" "$dest" 2>/dev/null || {
|
| 294 |
+
log_warn "Falha ao clonar $node_name"
|
| 295 |
+
return 0 # Não falhar, apenas avisar
|
| 296 |
+
}
|
| 297 |
fi
|
| 298 |
|
| 299 |
+
# Instalar requirements se existir (com timeout)
|
| 300 |
if [ -f "$dest/requirements.txt" ]; then
|
| 301 |
+
timeout 120 python3 -m pip install --no-warn-script-location -q -r "$dest/requirements.txt" 2>/dev/null || {
|
| 302 |
+
log_warn "Falha ao instalar requirements para $node_name"
|
| 303 |
+
}
|
| 304 |
fi
|
| 305 |
+
|
| 306 |
+
return 0
|
| 307 |
}
|
| 308 |
|
| 309 |
# -----------------------------
|
|
|
|
| 361 |
fi
|
| 362 |
log_success "ComfyUI instalado em: $COMFY_DIR"
|
| 363 |
|
| 364 |
+
# [4] Instalar SageAttention
|
| 365 |
log_info "[4/7] Instalando SageAttention..."
|
| 366 |
+
if command_exists nvcc; then
|
| 367 |
+
log_info "Instalando dependências do SageAttention..."
|
| 368 |
+
python3 -m pip install "triton>=3.0.0" nvidia-ml-py -q 2>/dev/null || true
|
| 369 |
+
|
| 370 |
+
SAGE_DIR="/tmp/SageAttention"
|
| 371 |
+
rm -rf "$SAGE_DIR"
|
| 372 |
+
|
| 373 |
+
if git clone --depth 1 https://github.com/thu-ml/SageAttention.git "$SAGE_DIR" 2>/dev/null; then
|
| 374 |
cd "$SAGE_DIR"
|
| 375 |
+
log_info "Compilando SageAttention (pode demorar alguns minutos)..."
|
| 376 |
+
python3 setup.py install 2>&1 | grep -E "(running|installing|copying)" || true
|
| 377 |
+
cd - > /dev/null
|
| 378 |
+
rm -rf "$SAGE_DIR"
|
| 379 |
log_success "SageAttention instalado"
|
| 380 |
else
|
| 381 |
+
log_warn "Não foi possível clonar SageAttention, continuando sem ele"
|
| 382 |
fi
|
| 383 |
+
else
|
| 384 |
+
log_warn "CUDA não detectado, pulando SageAttention"
|
| 385 |
+
fi
|
| 386 |
|
| 387 |
# [5] Baixar modelos
|
| 388 |
log_info "[5/7] Baixando modelos..."
|
|
|
|
| 407 |
CN_DIR="$COMFY_DIR/custom_nodes"
|
| 408 |
mkdir -p "$CN_DIR"
|
| 409 |
|
| 410 |
+
# Instalar nodes em paralelo mas com limite
|
| 411 |
+
MAX_PARALLEL=4
|
| 412 |
+
count=0
|
| 413 |
+
|
| 414 |
for repo_url in "${CUSTOM_NODES[@]}"; do
|
| 415 |
node_name=$(basename "$repo_url")
|
| 416 |
+
|
| 417 |
+
# Executar em background
|
| 418 |
+
(clone_or_update "$repo_url" "$CN_DIR/$node_name") &
|
| 419 |
+
|
| 420 |
+
# Limitar número de processos paralelos
|
| 421 |
+
((count++))
|
| 422 |
+
if [ $((count % MAX_PARALLEL)) -eq 0 ]; then
|
| 423 |
+
wait # Aguardar batch atual terminar
|
| 424 |
+
fi
|
| 425 |
done
|
| 426 |
+
|
| 427 |
+
# Aguardar últimos processos
|
| 428 |
wait
|
| 429 |
|
| 430 |
log_success "Custom nodes instalados"
|
| 431 |
|
|
|
|
|
|
|
|
|
|
| 432 |
# [7] Verificação final
|
| 433 |
echo ""
|
| 434 |
log_info "[7/7] Verificando instalação..."
|