Update WANcomfyui_installer_fixed.sh
Browse files- WANcomfyui_installer_fixed.sh +228 -268
WANcomfyui_installer_fixed.sh
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# ============================================================================
|
| 4 |
-
# Instalador
|
| 5 |
-
#
|
| 6 |
-
# Versão: 2.0 - Corrigida e Otimizada
|
| 7 |
# ============================================================================
|
| 8 |
|
| 9 |
set -e
|
|
@@ -13,18 +12,16 @@ set -o pipefail
|
|
| 13 |
# CONFIGURAÇÕES GLOBAIS
|
| 14 |
# ============================================================================
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
readonly WORKFLOW_URL="https://huggingface.co/adbrasi/akarris_trainer/resolve/main/Wan_GenerationBase.json"
|
| 18 |
-
|
| 19 |
-
# --- Caminhos Dinâmicos ---
|
| 20 |
readonly INSTALL_BASE_DIR="$(pwd)"
|
| 21 |
readonly WORKSPACE_DIR="$INSTALL_BASE_DIR/ComfyUI"
|
| 22 |
readonly WORKFLOW_FILENAME="workflow.json"
|
| 23 |
readonly WORKFLOW_FILE="$INSTALL_BASE_DIR/$WORKFLOW_FILENAME"
|
| 24 |
-
|
| 25 |
-
# Arquivo de log
|
| 26 |
readonly LOG_FILE="$INSTALL_BASE_DIR/install.log"
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
# ============================================================================
|
| 29 |
# FUNÇÕES DE UTILIDADE
|
| 30 |
# ============================================================================
|
|
@@ -75,7 +72,7 @@ check_requirements() {
|
|
| 75 |
|
| 76 |
if [ ${#missing_deps[@]} -gt 0 ]; then
|
| 77 |
log_error "Dependências faltando: ${missing_deps[*]}"
|
| 78 |
-
log_error "Por favor, instale as dependências
|
| 79 |
exit 1
|
| 80 |
fi
|
| 81 |
|
|
@@ -92,7 +89,7 @@ check_requirements() {
|
|
| 92 |
}
|
| 93 |
|
| 94 |
# ============================================================================
|
| 95 |
-
#
|
| 96 |
# ============================================================================
|
| 97 |
|
| 98 |
cleanup_existing_installation() {
|
|
@@ -111,7 +108,7 @@ cleanup_existing_installation() {
|
|
| 111 |
exit 1
|
| 112 |
fi
|
| 113 |
else
|
| 114 |
-
log_info "Nenhuma instalação anterior encontrada
|
| 115 |
fi
|
| 116 |
}
|
| 117 |
|
|
@@ -131,12 +128,11 @@ install_comfy_cli() {
|
|
| 131 |
# Adiciona ~/.local/bin ao PATH se necessário
|
| 132 |
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
| 133 |
export PATH="$HOME/.local/bin:$PATH"
|
| 134 |
-
log_info "Adicionado $HOME/.local/bin ao PATH
|
| 135 |
fi
|
| 136 |
|
| 137 |
if ! command_exists comfy; then
|
| 138 |
-
log_error "Comando 'comfy' não encontrado no PATH
|
| 139 |
-
log_error "Tente executar: export PATH=\"\$HOME/.local/bin:\$PATH\""
|
| 140 |
return 1
|
| 141 |
fi
|
| 142 |
|
|
@@ -162,13 +158,13 @@ install_comfyui() {
|
|
| 162 |
}
|
| 163 |
|
| 164 |
# ============================================================================
|
| 165 |
-
# INSTALAÇÃO DO HUGGINGFACE HUB
|
| 166 |
# ============================================================================
|
| 167 |
|
| 168 |
install_hf_tools() {
|
| 169 |
-
log_info "Instalando HuggingFace Hub
|
| 170 |
|
| 171 |
-
python3 -m pip install -U "huggingface_hub[cli]"
|
| 172 |
log_error "Falha ao instalar ferramentas HuggingFace"
|
| 173 |
return 1
|
| 174 |
}
|
|
@@ -181,7 +177,7 @@ install_hf_tools() {
|
|
| 181 |
}
|
| 182 |
|
| 183 |
# ============================================================================
|
| 184 |
-
# INSTALAÇÃO DO SAGEATTENTION 2.2.0
|
| 185 |
# ============================================================================
|
| 186 |
|
| 187 |
install_sageattention() {
|
|
@@ -196,7 +192,7 @@ install_sageattention() {
|
|
| 196 |
fi
|
| 197 |
|
| 198 |
# Instala dependências necessárias
|
| 199 |
-
log_info "Instalando dependências do SageAttention
|
| 200 |
python3 -m pip install 'triton>=3.0.0,<3.1.0' packaging ninja || {
|
| 201 |
log_error "Falha ao instalar dependências do SageAttention"
|
| 202 |
return 1
|
|
@@ -223,18 +219,17 @@ install_sageattention() {
|
|
| 223 |
local cuda_capability=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -n1 | tr -d '.')
|
| 224 |
if [ -n "$cuda_capability" ]; then
|
| 225 |
log_info "Detectada capacidade CUDA: $cuda_capability"
|
| 226 |
-
# Adiciona a arquitetura detectada se não for Ada
|
| 227 |
if [ "$cuda_capability" != "89" ]; then
|
| 228 |
export TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;${cuda_capability:0:1}.${cuda_capability:1}"
|
| 229 |
-
log_info "TORCH_CUDA_ARCH_LIST
|
| 230 |
fi
|
| 231 |
fi
|
| 232 |
fi
|
| 233 |
|
| 234 |
# Compila e instala
|
| 235 |
-
log_info "Compilando SageAttention (
|
| 236 |
if ! python3 setup.py install >> "$LOG_FILE" 2>&1; then
|
| 237 |
-
log_error "Falha ao compilar SageAttention. Verifique $LOG_FILE
|
| 238 |
cd "$INSTALL_BASE_DIR"
|
| 239 |
return 1
|
| 240 |
fi
|
|
@@ -244,77 +239,6 @@ install_sageattention() {
|
|
| 244 |
return 0
|
| 245 |
}
|
| 246 |
|
| 247 |
-
# ============================================================================
|
| 248 |
-
# FUNÇÃO DE DOWNLOAD COM RETRY E VERIFICAÇÃO
|
| 249 |
-
# ============================================================================
|
| 250 |
-
|
| 251 |
-
download_file_with_retry() {
|
| 252 |
-
local url="$1"
|
| 253 |
-
local dest_dir="$2"
|
| 254 |
-
local filename="${3:-}"
|
| 255 |
-
local max_retries=3
|
| 256 |
-
local retry_count=0
|
| 257 |
-
|
| 258 |
-
# Remove parâmetros de query do nome do arquivo se não foi especificado
|
| 259 |
-
if [ -z "$filename" ]; then
|
| 260 |
-
filename=$(basename "${url%%\?*}")
|
| 261 |
-
fi
|
| 262 |
-
|
| 263 |
-
local dest_file="$dest_dir/$filename"
|
| 264 |
-
|
| 265 |
-
# Cria o diretório de destino se não existir
|
| 266 |
-
mkdir -p "$dest_dir"
|
| 267 |
-
|
| 268 |
-
while [ $retry_count -lt $max_retries ]; do
|
| 269 |
-
log_info "Baixando: $filename (tentativa $((retry_count + 1))/$max_retries)"
|
| 270 |
-
|
| 271 |
-
# Usa huggingface-cli se disponível (mais confiável para HF)
|
| 272 |
-
if command_exists huggingface-cli && [[ "$url" == *"huggingface.co"* ]]; then
|
| 273 |
-
# Extrai repo e filename do URL do HuggingFace
|
| 274 |
-
local hf_path=$(echo "$url" | sed -n 's|.*huggingface.co/\([^/]*/[^/]*\)/resolve/main/\(.*\)\?.*|\1 \2|p')
|
| 275 |
-
if [ -n "$hf_path" ]; then
|
| 276 |
-
local repo=$(echo "$hf_path" | cut -d' ' -f1)
|
| 277 |
-
local file_path=$(echo "$hf_path" | cut -d' ' -f2)
|
| 278 |
-
|
| 279 |
-
export HF_HUB_ENABLE_HF_TRANSFER=1
|
| 280 |
-
if huggingface-cli download "$repo" "$file_path" --local-dir "$dest_dir" --local-dir-use-symlinks False >> "$LOG_FILE" 2>&1; then
|
| 281 |
-
# Move o arquivo para o nome correto se necessário
|
| 282 |
-
if [ -f "$dest_dir/$file_path" ] && [ "$file_path" != "$filename" ]; then
|
| 283 |
-
mv "$dest_dir/$file_path" "$dest_file"
|
| 284 |
-
fi
|
| 285 |
-
log_info "Download concluído: $filename"
|
| 286 |
-
return 0
|
| 287 |
-
fi
|
| 288 |
-
fi
|
| 289 |
-
fi
|
| 290 |
-
|
| 291 |
-
# Fallback para wget/curl
|
| 292 |
-
if command_exists wget; then
|
| 293 |
-
if wget -c -O "$dest_file" "$url" >> "$LOG_FILE" 2>&1; then
|
| 294 |
-
log_info "Download concluído: $filename"
|
| 295 |
-
return 0
|
| 296 |
-
fi
|
| 297 |
-
elif command_exists curl; then
|
| 298 |
-
if curl -L -C - -o "$dest_file" "$url" >> "$LOG_FILE" 2>&1; then
|
| 299 |
-
log_info "Download concluído: $filename"
|
| 300 |
-
return 0
|
| 301 |
-
fi
|
| 302 |
-
else
|
| 303 |
-
log_error "Nenhuma ferramenta de download (wget/curl) encontrada."
|
| 304 |
-
return 1
|
| 305 |
-
fi
|
| 306 |
-
|
| 307 |
-
retry_count=$((retry_count + 1))
|
| 308 |
-
if [ $retry_count -lt $max_retries ]; then
|
| 309 |
-
log_warning "Download falhou. Tentando novamente em 5 segundos..."
|
| 310 |
-
sleep 5
|
| 311 |
-
fi
|
| 312 |
-
done
|
| 313 |
-
|
| 314 |
-
log_error "Falha ao baixar $filename após $max_retries tentativas"
|
| 315 |
-
return 1
|
| 316 |
-
}
|
| 317 |
-
|
| 318 |
# ============================================================================
|
| 319 |
# DOWNLOAD DO WORKFLOW
|
| 320 |
# ============================================================================
|
|
@@ -322,19 +246,27 @@ download_file_with_retry() {
|
|
| 322 |
download_workflow() {
|
| 323 |
log_info "Baixando o workflow..."
|
| 324 |
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
|
|
|
|
|
|
|
|
|
| 330 |
fi
|
| 331 |
|
| 332 |
-
|
| 333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
}
|
| 335 |
|
| 336 |
# ============================================================================
|
| 337 |
-
# DOWNLOAD DE MODELOS WAN 2.2
|
| 338 |
# ============================================================================
|
| 339 |
|
| 340 |
download_models() {
|
|
@@ -351,131 +283,103 @@ download_models() {
|
|
| 351 |
|
| 352 |
for dir in "${dirs[@]}"; do
|
| 353 |
mkdir -p "$dir"
|
| 354 |
-
log_info "Diretório criado: $dir"
|
| 355 |
done
|
| 356 |
|
| 357 |
-
#
|
| 358 |
-
|
| 359 |
|
| 360 |
-
#
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
elif [ -f "$dest_dir/$filename" ]; then
|
| 413 |
-
log_info "✓ Download concluído: $filename"
|
| 414 |
-
else
|
| 415 |
-
log_warning "Arquivo baixado mas não encontrado no destino esperado"
|
| 416 |
-
failed_downloads+=("$filename")
|
| 417 |
-
fi
|
| 418 |
-
else
|
| 419 |
-
log_warning "Falha ao baixar com huggingface-cli: $filename"
|
| 420 |
-
failed_downloads+=("$filename")
|
| 421 |
-
fi
|
| 422 |
-
done
|
| 423 |
-
|
| 424 |
-
else
|
| 425 |
-
# Fallback para wget/curl
|
| 426 |
-
log_info "huggingface-cli não disponível, usando wget/curl"
|
| 427 |
-
|
| 428 |
-
local models=(
|
| 429 |
-
# URLs completas com destinos
|
| 430 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/diffusion_models/wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors:$WORKSPACE_DIR/models/diffusion_models:wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors"
|
| 431 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/diffusion_models/wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors:$WORKSPACE_DIR/models/diffusion_models:wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors"
|
| 432 |
-
"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:$WORKSPACE_DIR/models/loras:wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors"
|
| 433 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_low_noise.safetensors:$WORKSPACE_DIR/models/loras:wan2.2_i2v_lightx2v_4steps_lora_v1_low_noise.safetensors"
|
| 434 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/loras/wan2.2_t2v_lightx2v_4steps_lora_v1.1_high_noise.safetensors:$WORKSPACE_DIR/models/loras:wan2.2_t2v_lightx2v_4steps_lora_v1.1_high_noise.safetensors"
|
| 435 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/loras/wan2.2_t2v_lightx2v_4steps_lora_v1.1_low_noise.safetensors:$WORKSPACE_DIR/models/loras:wan2.2_t2v_lightx2v_4steps_lora_v1.1_low_noise.safetensors"
|
| 436 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp16.safetensors:$WORKSPACE_DIR/models/text_encoders:umt5_xxl_fp16.safetensors"
|
| 437 |
-
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors:$WORKSPACE_DIR/models/text_encoders:umt5_xxl_fp8_e4m3fn_scaled.safetensors"
|
| 438 |
-
"https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors:$WORKSPACE_DIR/models/vae:wan_2.1_vae.safetensors"
|
| 439 |
-
"https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/clip_vision/clip_vision_h.safetensors:$WORKSPACE_DIR/models/clip_vision:clip_vision_h.safetensors"
|
| 440 |
-
)
|
| 441 |
-
|
| 442 |
-
local total=${#models[@]}
|
| 443 |
-
local current=0
|
| 444 |
-
local failed_downloads=()
|
| 445 |
-
|
| 446 |
-
for model_info in "${models[@]}"; do
|
| 447 |
-
IFS=':' read -r url dest_dir filename <<< "$model_info"
|
| 448 |
-
current=$((current + 1))
|
| 449 |
-
|
| 450 |
-
log_info "[$current/$total] Baixando: $filename"
|
| 451 |
-
|
| 452 |
-
if ! download_file_with_retry "$url" "$dest_dir" "$filename"; then
|
| 453 |
-
failed_downloads+=("$filename")
|
| 454 |
-
log_warning "Falha ao baixar: $filename"
|
| 455 |
-
fi
|
| 456 |
-
done
|
| 457 |
fi
|
| 458 |
|
| 459 |
-
#
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
return 1
|
| 468 |
-
else
|
| 469 |
-
log_info "✓ Todos os modelos foram baixados com sucesso!"
|
| 470 |
fi
|
| 471 |
-
log_info "================================================="
|
| 472 |
|
| 473 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 474 |
log_info "Verificando modelos baixados:"
|
| 475 |
for dir in "${dirs[@]}"; do
|
| 476 |
if [ -d "$dir" ]; then
|
| 477 |
-
local count=$(ls -1 "$dir" 2>/dev/null | wc -l)
|
| 478 |
-
log_info " $dir: $count arquivo(s)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
fi
|
| 480 |
done
|
| 481 |
|
|
@@ -483,48 +387,81 @@ download_models() {
|
|
| 483 |
}
|
| 484 |
|
| 485 |
# ============================================================================
|
| 486 |
-
# INSTALAÇÃO DE CUSTOM NODES
|
| 487 |
# ============================================================================
|
| 488 |
|
| 489 |
-
|
| 490 |
-
log_info "Instalando custom nodes
|
| 491 |
|
| 492 |
-
|
| 493 |
-
if [ -f "$WORKFLOW_FILE" ]; then
|
| 494 |
-
log_info "Instalando dependências do workflow..."
|
| 495 |
-
comfy --workspace "$WORKSPACE_DIR" node install-deps --workflow="$WORKFLOW_FILE" >> "$LOG_FILE" 2>&1 || {
|
| 496 |
-
log_warning "Algumas dependências do workflow podem ter falhado ao instalar."
|
| 497 |
-
}
|
| 498 |
-
fi
|
| 499 |
|
| 500 |
-
# Lista de custom nodes
|
| 501 |
local custom_nodes=(
|
| 502 |
-
"https://github.com/
|
| 503 |
-
"https://github.com/
|
| 504 |
"https://github.com/kijai/ComfyUI-KJNodes"
|
| 505 |
-
"https://github.com/kijai/ComfyUI-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 506 |
)
|
| 507 |
|
| 508 |
-
|
| 509 |
|
| 510 |
for node_url in "${custom_nodes[@]}"; do
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
fi
|
| 516 |
done
|
| 517 |
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
for node in "${failed_nodes[@]}"; do
|
| 521 |
-
log_warning " - $node"
|
| 522 |
-
done
|
| 523 |
-
else
|
| 524 |
-
log_info "Todos os custom nodes foram instalados com sucesso!"
|
| 525 |
-
fi
|
| 526 |
-
|
| 527 |
-
return 0
|
| 528 |
}
|
| 529 |
|
| 530 |
# ============================================================================
|
|
@@ -546,25 +483,49 @@ verify_installation() {
|
|
| 546 |
issues+=("Arquivo de workflow não encontrado")
|
| 547 |
fi
|
| 548 |
|
| 549 |
-
# Verifica
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 553 |
|
| 554 |
# Verifica SageAttention
|
| 555 |
if ! python3 -c "import sageattention" 2>/dev/null; then
|
| 556 |
log_warning "SageAttention não está instalado (opcional)"
|
|
|
|
|
|
|
| 557 |
fi
|
| 558 |
|
| 559 |
if [ ${#issues[@]} -gt 0 ]; then
|
| 560 |
log_error "Problemas encontrados na instalação:"
|
| 561 |
for issue in "${issues[@]}"; do
|
| 562 |
-
log_error "
|
| 563 |
done
|
| 564 |
return 1
|
| 565 |
fi
|
| 566 |
|
| 567 |
-
log_info "Instalação verificada com sucesso!"
|
| 568 |
return 0
|
| 569 |
}
|
| 570 |
|
|
@@ -583,8 +544,8 @@ launch_comfyui() {
|
|
| 583 |
log_info " Workflow: $WORKFLOW_FILE"
|
| 584 |
log_info ""
|
| 585 |
log_info "Para usar o workflow:"
|
| 586 |
-
log_info " 1. Acesse http://127.0.0.1:8818
|
| 587 |
-
log_info " 2. Arraste
|
| 588 |
log_info ""
|
| 589 |
log_info "Pressione Ctrl+C para parar o servidor"
|
| 590 |
log_info "================================================="
|
|
@@ -614,7 +575,7 @@ main() {
|
|
| 614 |
echo "=== Instalação ComfyUI iniciada em $(date) ===" > "$LOG_FILE"
|
| 615 |
|
| 616 |
log_info "================================================="
|
| 617 |
-
log_info "Instalador ComfyUI com Wan 2.2"
|
| 618 |
log_info "================================================="
|
| 619 |
|
| 620 |
# Etapa 1: Verificar requisitos
|
|
@@ -635,29 +596,27 @@ main() {
|
|
| 635 |
# Etapa 6: Baixar workflow
|
| 636 |
download_workflow || log_warning "Workflow não foi baixado"
|
| 637 |
|
| 638 |
-
# Etapa 7: Instalar custom nodes
|
| 639 |
-
|
| 640 |
|
| 641 |
-
# Etapa 8: PROCESSOS PARALELOS - SageAttention e Downloads
|
| 642 |
log_info "================================================="
|
| 643 |
log_info "Iniciando processos paralelos:"
|
| 644 |
-
log_info " 1. Instalação do SageAttention (5-10
|
| 645 |
-
log_info " 2. Download dos modelos Wan 2.2
|
| 646 |
log_info "================================================="
|
| 647 |
|
| 648 |
# Inicia instalação do SageAttention em background
|
| 649 |
-
log_info "Iniciando instalação do SageAttention em background..."
|
| 650 |
install_sageattention &
|
| 651 |
local sage_pid=$!
|
| 652 |
|
| 653 |
# Inicia downloads dos modelos em background
|
| 654 |
-
log_info "Iniciando downloads dos modelos em background..."
|
| 655 |
download_models &
|
| 656 |
local models_pid=$!
|
| 657 |
|
| 658 |
# Monitor de progresso
|
| 659 |
log_info "Aguardando conclusão dos processos paralelos..."
|
| 660 |
-
log_info "
|
| 661 |
|
| 662 |
local both_done=false
|
| 663 |
local sage_done=false
|
|
@@ -696,22 +655,23 @@ main() {
|
|
| 696 |
if [ "$sage_done" = true ] && [ "$models_done" = true ]; then
|
| 697 |
both_done=true
|
| 698 |
else
|
| 699 |
-
|
| 700 |
-
sleep 30
|
| 701 |
if [ "$sage_done" = false ] && ps -p $sage_pid > /dev/null 2>&1; then
|
| 702 |
-
|
| 703 |
fi
|
| 704 |
if [ "$models_done" = false ] && ps -p $models_pid > /dev/null 2>&1; then
|
| 705 |
-
|
| 706 |
fi
|
| 707 |
fi
|
| 708 |
done
|
| 709 |
|
|
|
|
| 710 |
log_info "Todos os processos paralelos foram concluídos!"
|
| 711 |
|
| 712 |
# Etapa 9: Verificar instalação
|
| 713 |
verify_installation || {
|
| 714 |
log_error "A instalação teve problemas. Verifique o log em: $LOG_FILE"
|
|
|
|
| 715 |
exit 1
|
| 716 |
}
|
| 717 |
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
|
| 3 |
# ============================================================================
|
| 4 |
+
# Instalador Otimizado para ComfyUI com Wan 2.2
|
| 5 |
+
# Versão 3.0 - Corrigida com instalação manual de custom nodes
|
|
|
|
| 6 |
# ============================================================================
|
| 7 |
|
| 8 |
set -e
|
|
|
|
| 12 |
# CONFIGURAÇÕES GLOBAIS
|
| 13 |
# ============================================================================
|
| 14 |
|
| 15 |
+
# Diretórios base
|
|
|
|
|
|
|
|
|
|
| 16 |
readonly INSTALL_BASE_DIR="$(pwd)"
|
| 17 |
readonly WORKSPACE_DIR="$INSTALL_BASE_DIR/ComfyUI"
|
| 18 |
readonly WORKFLOW_FILENAME="workflow.json"
|
| 19 |
readonly WORKFLOW_FILE="$INSTALL_BASE_DIR/$WORKFLOW_FILENAME"
|
|
|
|
|
|
|
| 20 |
readonly LOG_FILE="$INSTALL_BASE_DIR/install.log"
|
| 21 |
|
| 22 |
+
# URL do workflow
|
| 23 |
+
readonly WORKFLOW_URL="https://huggingface.co/adbrasi/akarris_trainer/resolve/main/Wan_GenerationBase.json"
|
| 24 |
+
|
| 25 |
# ============================================================================
|
| 26 |
# FUNÇÕES DE UTILIDADE
|
| 27 |
# ============================================================================
|
|
|
|
| 72 |
|
| 73 |
if [ ${#missing_deps[@]} -gt 0 ]; then
|
| 74 |
log_error "Dependências faltando: ${missing_deps[*]}"
|
| 75 |
+
log_error "Por favor, instale as dependências e execute o script novamente."
|
| 76 |
exit 1
|
| 77 |
fi
|
| 78 |
|
|
|
|
| 89 |
}
|
| 90 |
|
| 91 |
# ============================================================================
|
| 92 |
+
# LIMPEZA DE INSTALAÇÃO EXISTENTE
|
| 93 |
# ============================================================================
|
| 94 |
|
| 95 |
cleanup_existing_installation() {
|
|
|
|
| 108 |
exit 1
|
| 109 |
fi
|
| 110 |
else
|
| 111 |
+
log_info "Nenhuma instalação anterior encontrada."
|
| 112 |
fi
|
| 113 |
}
|
| 114 |
|
|
|
|
| 128 |
# Adiciona ~/.local/bin ao PATH se necessário
|
| 129 |
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
| 130 |
export PATH="$HOME/.local/bin:$PATH"
|
| 131 |
+
log_info "Adicionado $HOME/.local/bin ao PATH."
|
| 132 |
fi
|
| 133 |
|
| 134 |
if ! command_exists comfy; then
|
| 135 |
+
log_error "Comando 'comfy' não encontrado no PATH."
|
|
|
|
| 136 |
return 1
|
| 137 |
fi
|
| 138 |
|
|
|
|
| 158 |
}
|
| 159 |
|
| 160 |
# ============================================================================
|
| 161 |
+
# INSTALAÇÃO DO HUGGINGFACE HUB
|
| 162 |
# ============================================================================
|
| 163 |
|
| 164 |
install_hf_tools() {
|
| 165 |
+
log_info "Instalando HuggingFace Hub e hf_transfer..."
|
| 166 |
|
| 167 |
+
python3 -m pip install -U "huggingface_hub[cli,hf_transfer]" || {
|
| 168 |
log_error "Falha ao instalar ferramentas HuggingFace"
|
| 169 |
return 1
|
| 170 |
}
|
|
|
|
| 177 |
}
|
| 178 |
|
| 179 |
# ============================================================================
|
| 180 |
+
# INSTALAÇÃO DO SAGEATTENTION 2.2.0
|
| 181 |
# ============================================================================
|
| 182 |
|
| 183 |
install_sageattention() {
|
|
|
|
| 192 |
fi
|
| 193 |
|
| 194 |
# Instala dependências necessárias
|
| 195 |
+
log_info "Instalando dependências do SageAttention..."
|
| 196 |
python3 -m pip install 'triton>=3.0.0,<3.1.0' packaging ninja || {
|
| 197 |
log_error "Falha ao instalar dependências do SageAttention"
|
| 198 |
return 1
|
|
|
|
| 219 |
local cuda_capability=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader | head -n1 | tr -d '.')
|
| 220 |
if [ -n "$cuda_capability" ]; then
|
| 221 |
log_info "Detectada capacidade CUDA: $cuda_capability"
|
|
|
|
| 222 |
if [ "$cuda_capability" != "89" ]; then
|
| 223 |
export TORCH_CUDA_ARCH_LIST="$TORCH_CUDA_ARCH_LIST;${cuda_capability:0:1}.${cuda_capability:1}"
|
| 224 |
+
log_info "TORCH_CUDA_ARCH_LIST: $TORCH_CUDA_ARCH_LIST"
|
| 225 |
fi
|
| 226 |
fi
|
| 227 |
fi
|
| 228 |
|
| 229 |
# Compila e instala
|
| 230 |
+
log_info "Compilando SageAttention (5-10 minutos)..."
|
| 231 |
if ! python3 setup.py install >> "$LOG_FILE" 2>&1; then
|
| 232 |
+
log_error "Falha ao compilar SageAttention. Verifique $LOG_FILE"
|
| 233 |
cd "$INSTALL_BASE_DIR"
|
| 234 |
return 1
|
| 235 |
fi
|
|
|
|
| 239 |
return 0
|
| 240 |
}
|
| 241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
# ============================================================================
|
| 243 |
# DOWNLOAD DO WORKFLOW
|
| 244 |
# ============================================================================
|
|
|
|
| 246 |
download_workflow() {
|
| 247 |
log_info "Baixando o workflow..."
|
| 248 |
|
| 249 |
+
# Usa wget com user-agent para evitar bloqueios
|
| 250 |
+
if command_exists wget; then
|
| 251 |
+
wget -U "Mozilla/5.0" -O "$WORKFLOW_FILE" "$WORKFLOW_URL" 2>&1 | tee -a "$LOG_FILE"
|
| 252 |
+
elif command_exists curl; then
|
| 253 |
+
curl -L -H "User-Agent: Mozilla/5.0" -o "$WORKFLOW_FILE" "$WORKFLOW_URL" 2>&1 | tee -a "$LOG_FILE"
|
| 254 |
+
else
|
| 255 |
+
log_error "wget ou curl não encontrado"
|
| 256 |
+
return 1
|
| 257 |
fi
|
| 258 |
|
| 259 |
+
if [ -f "$WORKFLOW_FILE" ] && [ -s "$WORKFLOW_FILE" ]; then
|
| 260 |
+
log_info "Workflow baixado com sucesso."
|
| 261 |
+
return 0
|
| 262 |
+
else
|
| 263 |
+
log_error "Falha ao baixar o workflow."
|
| 264 |
+
return 1
|
| 265 |
+
fi
|
| 266 |
}
|
| 267 |
|
| 268 |
# ============================================================================
|
| 269 |
+
# DOWNLOAD DE MODELOS WAN 2.2 (CORRIGIDO)
|
| 270 |
# ============================================================================
|
| 271 |
|
| 272 |
download_models() {
|
|
|
|
| 283 |
|
| 284 |
for dir in "${dirs[@]}"; do
|
| 285 |
mkdir -p "$dir"
|
| 286 |
+
log_info "Diretório criado/verificado: $dir"
|
| 287 |
done
|
| 288 |
|
| 289 |
+
# Configuração para usar hf
|
| 290 |
+
export HF_HUB_ENABLE_HF_TRANSFER=1
|
| 291 |
|
| 292 |
+
# Lista de modelos organizados por tipo
|
| 293 |
+
log_info "Baixando modelos de difusão..."
|
| 294 |
+
|
| 295 |
+
# Diffusion Models
|
| 296 |
+
hf download "Comfy-Org/Wan_2.2_ComfyUI_Repackaged" \
|
| 297 |
+
"split_files/diffusion_models/wan2.2_i2v_high_noise_14B_fp8_scaled.safetensors" \
|
| 298 |
+
"split_files/diffusion_models/wan2.2_i2v_low_noise_14B_fp8_scaled.safetensors" \
|
| 299 |
+
--local-dir "$WORKSPACE_DIR/models" \
|
| 300 |
+
--cache-dir "$WORKSPACE_DIR/models/.cache" 2>&1 | tee -a "$LOG_FILE"
|
| 301 |
+
|
| 302 |
+
log_info "Baixando LoRAs..."
|
| 303 |
+
|
| 304 |
+
# LoRAs
|
| 305 |
+
hf download "Comfy-Org/Wan_2.2_ComfyUI_Repackaged" \
|
| 306 |
+
"split_files/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_high_noise.safetensors" \
|
| 307 |
+
"split_files/loras/wan2.2_i2v_lightx2v_4steps_lora_v1_low_noise.safetensors" \
|
| 308 |
+
"split_files/loras/wan2.2_t2v_lightx2v_4steps_lora_v1.1_high_noise.safetensors" \
|
| 309 |
+
"split_files/loras/wan2.2_t2v_lightx2v_4steps_lora_v1.1_low_noise.safetensors" \
|
| 310 |
+
--local-dir "$WORKSPACE_DIR/models" \
|
| 311 |
+
--cache-dir "$WORKSPACE_DIR/models/.cache" 2>&1 | tee -a "$LOG_FILE"
|
| 312 |
+
|
| 313 |
+
log_info "Baixando Text Encoders..."
|
| 314 |
+
|
| 315 |
+
# Text Encoders
|
| 316 |
+
hf download "Comfy-Org/Wan_2.2_ComfyUI_Repackaged" \
|
| 317 |
+
"split_files/text_encoders/umt5_xxl_fp16.safetensors" \
|
| 318 |
+
"split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors" \
|
| 319 |
+
--local-dir "$WORKSPACE_DIR/models" \
|
| 320 |
+
--cache-dir "$WORKSPACE_DIR/models/.cache" 2>&1 | tee -a "$LOG_FILE"
|
| 321 |
+
|
| 322 |
+
log_info "Baixando VAE..."
|
| 323 |
+
|
| 324 |
+
# VAE
|
| 325 |
+
hf download "Comfy-Org/Wan_2.1_ComfyUI_repackaged" \
|
| 326 |
+
"split_files/vae/wan_2.1_vae.safetensors" \
|
| 327 |
+
--local-dir "$WORKSPACE_DIR/models" \
|
| 328 |
+
--cache-dir "$WORKSPACE_DIR/models/.cache" 2>&1 | tee -a "$LOG_FILE"
|
| 329 |
+
|
| 330 |
+
log_info "Baixando CLIP Vision..."
|
| 331 |
+
|
| 332 |
+
# CLIP Vision
|
| 333 |
+
hf download "Comfy-Org/Wan_2.1_ComfyUI_repackaged" \
|
| 334 |
+
"split_files/clip_vision/clip_vision_h.safetensors" \
|
| 335 |
+
--local-dir "$WORKSPACE_DIR/models" \
|
| 336 |
+
--cache-dir "$WORKSPACE_DIR/models/.cache" 2>&1 | tee -a "$LOG_FILE"
|
| 337 |
+
|
| 338 |
+
# Move arquivos dos subdiretórios para os locais corretos
|
| 339 |
+
log_info "Organizando arquivos de modelos..."
|
| 340 |
+
|
| 341 |
+
# Move diffusion models
|
| 342 |
+
if [ -d "$WORKSPACE_DIR/models/split_files/diffusion_models" ]; then
|
| 343 |
+
mv "$WORKSPACE_DIR/models/split_files/diffusion_models/"*.safetensors "$WORKSPACE_DIR/models/diffusion_models/" 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
fi
|
| 345 |
|
| 346 |
+
# Move loras
|
| 347 |
+
if [ -d "$WORKSPACE_DIR/models/split_files/loras" ]; then
|
| 348 |
+
mv "$WORKSPACE_DIR/models/split_files/loras/"*.safetensors "$WORKSPACE_DIR/models/loras/" 2>/dev/null || true
|
| 349 |
+
fi
|
| 350 |
+
|
| 351 |
+
# Move text encoders
|
| 352 |
+
if [ -d "$WORKSPACE_DIR/models/split_files/text_encoders" ]; then
|
| 353 |
+
mv "$WORKSPACE_DIR/models/split_files/text_encoders/"*.safetensors "$WORKSPACE_DIR/models/text_encoders/" 2>/dev/null || true
|
|
|
|
|
|
|
|
|
|
| 354 |
fi
|
|
|
|
| 355 |
|
| 356 |
+
# Move vae
|
| 357 |
+
if [ -d "$WORKSPACE_DIR/models/split_files/vae" ]; then
|
| 358 |
+
mv "$WORKSPACE_DIR/models/split_files/vae/"*.safetensors "$WORKSPACE_DIR/models/vae/" 2>/dev/null || true
|
| 359 |
+
fi
|
| 360 |
+
|
| 361 |
+
# Move clip vision
|
| 362 |
+
if [ -d "$WORKSPACE_DIR/models/split_files/clip_vision" ]; then
|
| 363 |
+
mv "$WORKSPACE_DIR/models/split_files/clip_vision/"*.safetensors "$WORKSPACE_DIR/models/clip_vision/" 2>/dev/null || true
|
| 364 |
+
fi
|
| 365 |
+
|
| 366 |
+
# Remove diretório split_files vazio
|
| 367 |
+
rm -rf "$WORKSPACE_DIR/models/split_files" 2>/dev/null || true
|
| 368 |
+
|
| 369 |
+
# Verifica arquivos baixados
|
| 370 |
log_info "Verificando modelos baixados:"
|
| 371 |
for dir in "${dirs[@]}"; do
|
| 372 |
if [ -d "$dir" ]; then
|
| 373 |
+
local count=$(ls -1 "$dir"/*.safetensors 2>/dev/null | wc -l)
|
| 374 |
+
log_info " $(basename $(dirname "$dir"))/$(basename "$dir"): $count arquivo(s)"
|
| 375 |
+
|
| 376 |
+
# Lista os arquivos
|
| 377 |
+
for file in "$dir"/*.safetensors; do
|
| 378 |
+
if [ -f "$file" ]; then
|
| 379 |
+
local size=$(du -h "$file" | cut -f1)
|
| 380 |
+
log_info " - $(basename "$file") ($size)"
|
| 381 |
+
fi
|
| 382 |
+
done
|
| 383 |
fi
|
| 384 |
done
|
| 385 |
|
|
|
|
| 387 |
}
|
| 388 |
|
| 389 |
# ============================================================================
|
| 390 |
+
# INSTALAÇÃO MANUAL DE CUSTOM NODES
|
| 391 |
# ============================================================================
|
| 392 |
|
| 393 |
+
install_custom_nodes_manually() {
|
| 394 |
+
log_info "Instalando custom nodes manualmente..."
|
| 395 |
|
| 396 |
+
local custom_nodes_dir="$WORKSPACE_DIR/custom_nodes"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
|
| 398 |
+
# Lista completa de custom nodes (sem duplicatas)
|
| 399 |
local custom_nodes=(
|
| 400 |
+
"https://github.com/kijai/ComfyUI-WanVideoWrapper"
|
| 401 |
+
"https://github.com/kijai/ComfyUI-MelBandRoFormer"
|
| 402 |
"https://github.com/kijai/ComfyUI-KJNodes"
|
| 403 |
+
"https://github.com/kijai/ComfyUI-Florence2"
|
| 404 |
+
"https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"
|
| 405 |
+
"https://github.com/Fannovel16/ComfyUI-Frame-Interpolation"
|
| 406 |
+
"https://github.com/Artificial-Sweetener/comfyui-WhiteRabbit"
|
| 407 |
+
"https://github.com/rdancer/ComfyUI_Florence2SAM2"
|
| 408 |
+
"https://github.com/1038lab/ComfyUI-RMBG"
|
| 409 |
+
"https://github.com/fpgaminer/joycaption_comfyui"
|
| 410 |
+
"https://github.com/MieMieeeee/ComfyUI-CaptionThis"
|
| 411 |
+
"https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes"
|
| 412 |
+
"https://github.com/LAOGOU-666/Comfyui-Memory_Cleanup"
|
| 413 |
+
"https://github.com/chrisgoringe/cg-use-everywhere"
|
| 414 |
+
"https://github.com/pythongosssss/ComfyUI-Custom-Scripts"
|
| 415 |
+
"https://github.com/chibiace/ComfyUI-Chibi-Nodes"
|
| 416 |
+
"https://github.com/ptmaster/comfyui-audio-speed"
|
| 417 |
+
"https://github.com/filliptm/ComfyUI_Fill-Nodes"
|
| 418 |
+
"https://github.com/justUmen/Bjornulf_custom_nodes"
|
| 419 |
+
"https://github.com/raindrop313/ComfyUI-WanVideoStartEndFrames"
|
| 420 |
+
"https://github.com/ShmuelRonen/ComfyUI_wav2lip"
|
| 421 |
+
"https://github.com/crystian/ComfyUI-Crystools"
|
| 422 |
+
"https://github.com/bash-j/mikey_nodes"
|
| 423 |
)
|
| 424 |
|
| 425 |
+
cd "$custom_nodes_dir"
|
| 426 |
|
| 427 |
for node_url in "${custom_nodes[@]}"; do
|
| 428 |
+
local node_name=$(basename "$node_url" .git)
|
| 429 |
+
log_info "Instalando: $node_name"
|
| 430 |
+
|
| 431 |
+
# Remove instalação anterior se existir
|
| 432 |
+
if [ -d "$node_name" ]; then
|
| 433 |
+
log_info " Removendo versão anterior..."
|
| 434 |
+
rm -rf "$node_name"
|
| 435 |
+
fi
|
| 436 |
+
|
| 437 |
+
# Clona o repositório
|
| 438 |
+
if git clone --depth 1 "$node_url" "$node_name" 2>&1 | tee -a "$LOG_FILE"; then
|
| 439 |
+
log_info " Clone concluído: $node_name"
|
| 440 |
+
|
| 441 |
+
# Instala requirements se existir
|
| 442 |
+
if [ -f "$node_name/requirements.txt" ]; then
|
| 443 |
+
log_info " Instalando dependências de $node_name..."
|
| 444 |
+
python3 -m pip install -r "$node_name/requirements.txt" 2>&1 | tee -a "$LOG_FILE" || {
|
| 445 |
+
log_warning " Algumas dependências de $node_name falharam"
|
| 446 |
+
}
|
| 447 |
+
fi
|
| 448 |
+
|
| 449 |
+
# Executa install.py se existir
|
| 450 |
+
if [ -f "$node_name/install.py" ]; then
|
| 451 |
+
log_info " Executando install.py de $node_name..."
|
| 452 |
+
cd "$node_name"
|
| 453 |
+
python3 install.py 2>&1 | tee -a "$LOG_FILE" || {
|
| 454 |
+
log_warning " install.py de $node_name retornou erro"
|
| 455 |
+
}
|
| 456 |
+
cd ..
|
| 457 |
+
fi
|
| 458 |
+
else
|
| 459 |
+
log_warning " Falha ao clonar: $node_name"
|
| 460 |
fi
|
| 461 |
done
|
| 462 |
|
| 463 |
+
cd "$INSTALL_BASE_DIR"
|
| 464 |
+
log_info "Instalação de custom nodes concluída!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
}
|
| 466 |
|
| 467 |
# ============================================================================
|
|
|
|
| 483 |
issues+=("Arquivo de workflow não encontrado")
|
| 484 |
fi
|
| 485 |
|
| 486 |
+
# Verifica modelos em cada diretório
|
| 487 |
+
log_info "Verificando modelos instalados:"
|
| 488 |
+
|
| 489 |
+
local expected_models=(
|
| 490 |
+
"diffusion_models:2"
|
| 491 |
+
"loras:4"
|
| 492 |
+
"text_encoders:2"
|
| 493 |
+
"vae:1"
|
| 494 |
+
"clip_vision:1"
|
| 495 |
+
)
|
| 496 |
+
|
| 497 |
+
for expectation in "${expected_models[@]}"; do
|
| 498 |
+
IFS=':' read -r dir_name expected_count <<< "$expectation"
|
| 499 |
+
local dir="$WORKSPACE_DIR/models/$dir_name"
|
| 500 |
+
|
| 501 |
+
if [ -d "$dir" ]; then
|
| 502 |
+
local count=$(ls -1 "$dir"/*.safetensors 2>/dev/null | wc -l)
|
| 503 |
+
log_info " $dir_name: $count arquivo(s) (esperado: $expected_count)"
|
| 504 |
+
|
| 505 |
+
if [ $count -lt $expected_count ]; then
|
| 506 |
+
issues+=("Faltam modelos em $dir_name ($count/$expected_count)")
|
| 507 |
+
fi
|
| 508 |
+
else
|
| 509 |
+
issues+=("Diretório não existe: $dir_name")
|
| 510 |
+
fi
|
| 511 |
+
done
|
| 512 |
|
| 513 |
# Verifica SageAttention
|
| 514 |
if ! python3 -c "import sageattention" 2>/dev/null; then
|
| 515 |
log_warning "SageAttention não está instalado (opcional)"
|
| 516 |
+
else
|
| 517 |
+
log_info "✓ SageAttention instalado corretamente"
|
| 518 |
fi
|
| 519 |
|
| 520 |
if [ ${#issues[@]} -gt 0 ]; then
|
| 521 |
log_error "Problemas encontrados na instalação:"
|
| 522 |
for issue in "${issues[@]}"; do
|
| 523 |
+
log_error " ✗ $issue"
|
| 524 |
done
|
| 525 |
return 1
|
| 526 |
fi
|
| 527 |
|
| 528 |
+
log_info "✓ Instalação verificada com sucesso!"
|
| 529 |
return 0
|
| 530 |
}
|
| 531 |
|
|
|
|
| 544 |
log_info " Workflow: $WORKFLOW_FILE"
|
| 545 |
log_info ""
|
| 546 |
log_info "Para usar o workflow:"
|
| 547 |
+
log_info " 1. Acesse http://127.0.0.1:8818"
|
| 548 |
+
log_info " 2. Arraste o arquivo '$WORKFLOW_FILENAME' na interface"
|
| 549 |
log_info ""
|
| 550 |
log_info "Pressione Ctrl+C para parar o servidor"
|
| 551 |
log_info "================================================="
|
|
|
|
| 575 |
echo "=== Instalação ComfyUI iniciada em $(date) ===" > "$LOG_FILE"
|
| 576 |
|
| 577 |
log_info "================================================="
|
| 578 |
+
log_info "Instalador ComfyUI com Wan 2.2 - v3.0"
|
| 579 |
log_info "================================================="
|
| 580 |
|
| 581 |
# Etapa 1: Verificar requisitos
|
|
|
|
| 596 |
# Etapa 6: Baixar workflow
|
| 597 |
download_workflow || log_warning "Workflow não foi baixado"
|
| 598 |
|
| 599 |
+
# Etapa 7: Instalar custom nodes manualmente
|
| 600 |
+
install_custom_nodes_manually
|
| 601 |
|
| 602 |
+
# Etapa 8: PROCESSOS PARALELOS - SageAttention e Downloads
|
| 603 |
log_info "================================================="
|
| 604 |
log_info "Iniciando processos paralelos:"
|
| 605 |
+
log_info " 1. Instalação do SageAttention (5-10 min)"
|
| 606 |
+
log_info " 2. Download dos modelos Wan 2.2"
|
| 607 |
log_info "================================================="
|
| 608 |
|
| 609 |
# Inicia instalação do SageAttention em background
|
|
|
|
| 610 |
install_sageattention &
|
| 611 |
local sage_pid=$!
|
| 612 |
|
| 613 |
# Inicia downloads dos modelos em background
|
|
|
|
| 614 |
download_models &
|
| 615 |
local models_pid=$!
|
| 616 |
|
| 617 |
# Monitor de progresso
|
| 618 |
log_info "Aguardando conclusão dos processos paralelos..."
|
| 619 |
+
log_info "Monitore o progresso em: $LOG_FILE"
|
| 620 |
|
| 621 |
local both_done=false
|
| 622 |
local sage_done=false
|
|
|
|
| 655 |
if [ "$sage_done" = true ] && [ "$models_done" = true ]; then
|
| 656 |
both_done=true
|
| 657 |
else
|
| 658 |
+
sleep 10
|
|
|
|
| 659 |
if [ "$sage_done" = false ] && ps -p $sage_pid > /dev/null 2>&1; then
|
| 660 |
+
echo -n "."
|
| 661 |
fi
|
| 662 |
if [ "$models_done" = false ] && ps -p $models_pid > /dev/null 2>&1; then
|
| 663 |
+
echo -n "."
|
| 664 |
fi
|
| 665 |
fi
|
| 666 |
done
|
| 667 |
|
| 668 |
+
echo ""
|
| 669 |
log_info "Todos os processos paralelos foram concluídos!"
|
| 670 |
|
| 671 |
# Etapa 9: Verificar instalação
|
| 672 |
verify_installation || {
|
| 673 |
log_error "A instalação teve problemas. Verifique o log em: $LOG_FILE"
|
| 674 |
+
log_error "Você pode tentar executar o script novamente."
|
| 675 |
exit 1
|
| 676 |
}
|
| 677 |
|