adbrasi commited on
Commit
655fb22
·
verified ·
1 Parent(s): 48c217a

Update setup_comfyui_wan22.sh

Browse files
Files changed (1) hide show
  1. setup_comfyui_wan22.sh +150 -130
setup_comfyui_wan22.sh CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env bash
2
- # setup_comfyui_wan22_optimized.sh
3
- # Script otimizado para instalação do ComfyUI com Wan 2.2
4
  # Requisitos: Linux + Python3 + git + (opcional) NVCC/CUDA para SageAttention
5
 
6
  set -Eeuo pipefail
@@ -32,7 +32,7 @@ REPO_22="Comfy-Org/Wan_2.2_ComfyUI_Repackaged"
32
  REPO_21="Comfy-Org/Wan_2.1_ComfyUI_repackaged"
33
  REPO_CN="xinsir/controlnet-union-sdxl-1.0"
34
 
35
- # Token do Civitai (pode sobrescrever via env)
36
  CIVITAI_TOKEN="${CIVITAI_TOKEN:-4fcb2834969399006a736ee402b061e5}"
37
 
38
  # Configurações de performance
@@ -51,7 +51,6 @@ export NVCC_APPEND_FLAGS="--threads 8"
51
  # -----------------------------
52
  # Setup inicial
53
  # -----------------------------
54
- MODELS_DIR="$COMFY_DIR/models"
55
  TMPDL="$(mktemp -d)"
56
  cleanup() {
57
  log_info "Limpando arquivos temporários..."
@@ -74,12 +73,6 @@ need git
74
  need wget
75
  need curl
76
 
77
- # Criar estrutura de diretórios
78
- log_info "Criando estrutura de diretórios..."
79
- mkdir -p "$MODELS_DIR"/{diffusion_models,loras,vae,text_encoders,clip_vision,controlnet}
80
- mkdir -p "$COMFY_DIR/custom_nodes"
81
- mkdir -p "$TMPDL"/{wan22,wan21,controlnet,civitai}
82
-
83
  # -----------------------------
84
  # Funções auxiliares
85
  # -----------------------------
@@ -100,54 +93,58 @@ clone_or_update() {
100
  fi
101
  }
102
 
103
- download_with_progress() {
104
- local url="$1"
105
- local output="$2"
106
- local description="$3"
107
-
108
- log_info "Baixando: $description"
109
- wget --progress=bar:force:noscroll \
110
- --tries=3 \
111
- --timeout=30 \
112
- --continue \
113
- -O "$output" \
114
- "$url" 2>&1 | \
115
- grep --line-buffered "%" | \
116
- sed -u -e "s/^/ /"
117
- }
118
-
119
  # -----------------------------
120
  # Instalação principal
121
  # -----------------------------
122
  echo ""
123
  log_info "========================================="
124
- log_info " ComfyUI + Wan 2.2 Setup Otimizado"
125
  log_info " CPU Cores: $CPU_CORES | Jobs: $MAX_JOBS"
126
  log_info "========================================="
127
  echo ""
128
 
129
- # [1/7] Atualizar pip e instalar ferramentas essenciais
130
- log_info "[1/7] Atualizando pip e instalando ferramentas..."
131
- python3 -m pip install --quiet --upgrade pip wheel setuptools uv >/dev/null 2>&1
132
  python3 -m pip install --quiet --upgrade comfy-cli "huggingface_hub>=0.23.0" hf_transfer aria2 >/dev/null 2>&1
133
  log_success "Ferramentas instaladas"
134
 
135
- # [2/7] Instalar ComfyUI
136
- log_info "[2/7] Instalando ComfyUI (GPU NVIDIA, fast deps)..."
137
- if [ ! -d "$COMFY_DIR" ]; then
138
- comfy --skip-prompt install --fast-deps --nvidia
 
 
139
  else
140
- log_warn "ComfyUI existe, pulando instalação base"
 
 
 
 
 
 
 
 
 
 
 
141
  fi
142
- log_success "ComfyUI pronto"
143
 
144
- # [3/7] Baixar modelos Wan 2.2 (em paralelo com aria2)
145
- log_info "[3/7] Iniciando downloads dos modelos Wan 2.2..."
 
 
 
 
 
 
 
 
 
146
  (
147
  set -Eeuo pipefail
148
 
149
- # Wan 2.2
150
- log_info " → Baixando Wan 2.2 models..."
151
  huggingface-cli download "$REPO_22" \
152
  split_files/diffusion_models/wan2.2_fun_control_low_noise_14B_fp8_scaled.safetensors \
153
  split_files/diffusion_models/wan2.2_fun_control_high_noise_14B_fp8_scaled.safetensors \
@@ -157,39 +154,46 @@ log_info "[3/7] Iniciando downloads dos modelos Wan 2.2..."
157
  split_files/text_encoders/umt5_xxl_fp16.safetensors \
158
  --local-dir "$TMPDL/wan22" \
159
  --local-dir-use-symlinks False \
160
- --resume-download \
161
- --quiet 2>/dev/null || true
162
-
163
- # Wan 2.1
164
- log_info " → Baixando Wan 2.1 clip vision..."
165
- huggingface-cli download "$REPO_21" \
166
- split_files/clip_vision/clip_vision_h.safetensors \
167
- --local-dir "$TMPDL/wan21" \
168
- --local-dir-use-symlinks False \
169
- --resume-download \
170
- --quiet 2>/dev/null || true
171
 
172
  # Copiar para destino
173
  cp -f "$TMPDL/wan22/split_files/diffusion_models/"*.safetensors "$MODELS_DIR/diffusion_models/" 2>/dev/null || true
174
  cp -f "$TMPDL/wan22/split_files/loras/"*.safetensors "$MODELS_DIR/loras/" 2>/dev/null || true
175
  cp -f "$TMPDL/wan22/split_files/vae/"*.safetensors "$MODELS_DIR/vae/" 2>/dev/null || true
176
  cp -f "$TMPDL/wan22/split_files/text_encoders/"*.safetensors "$MODELS_DIR/text_encoders/" 2>/dev/null || true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  cp -f "$TMPDL/wan21/split_files/clip_vision/"*.safetensors "$MODELS_DIR/clip_vision/" 2>/dev/null || true
178
 
179
- log_success " Modelos Wan baixados"
180
  ) &
181
- WAN_PID=$!
182
 
183
- # [4/7] Baixar ControlNet (em paralelo)
184
- log_info "[4/7] Baixando ControlNet Union..."
185
  (
186
  set -Eeuo pipefail
 
187
  huggingface-cli download "$REPO_CN" \
188
  diffusion_pytorch_model_promax.safetensors \
189
  --local-dir "$TMPDL/controlnet" \
190
  --local-dir-use-symlinks False \
191
- --resume-download \
192
- --quiet 2>/dev/null || true
193
 
194
  cp -f "$TMPDL/controlnet/diffusion_pytorch_model_promax.safetensors" \
195
  "$MODELS_DIR/controlnet/controlnet-union.safetensors"
@@ -198,74 +202,80 @@ log_info "[4/7] Baixando ControlNet Union..."
198
  ) &
199
  CN_PID=$!
200
 
201
- # [5/7] Baixar modelo do Civitai (CORREÇÃO IMPORTANTE)
202
- log_info "[5/7] Baixando modelo do Civitai..."
203
  (
204
  set -Eeuo pipefail
205
- CIVITAI_URL="https://civitai.com/api/download/models/2122278"
206
- CIVITAI_PARAMS="type=Model&format=SafeTensor&size=pruned&fp=fp16&token=${CIVITAI_TOKEN}"
207
- FULL_URL="${CIVITAI_URL}?${CIVITAI_PARAMS}"
208
 
209
  cd "$MODELS_DIR/loras"
210
 
211
- # Usar curl com retry e progress bar
212
- curl -L \
213
- --retry 3 \
214
- --retry-delay 5 \
215
- --connect-timeout 30 \
216
- --max-time 1800 \
217
- --progress-bar \
218
- -H "User-Agent: Mozilla/5.0" \
219
- -o "civitai_model_temp.safetensors" \
220
- "$FULL_URL"
221
 
222
- # Renomear com o nome correto do header Content-Disposition se possível
223
- if [ -f "civitai_model_temp.safetensors" ]; then
224
- # Tentar obter o nome real do arquivo
225
- REAL_NAME=$(curl -sI -L "$FULL_URL" | grep -i content-disposition | sed -n 's/.*filename="\?\([^"]*\)"\?.*/\1/p' | head -1)
226
- if [ -n "$REAL_NAME" ]; then
227
- mv "civitai_model_temp.safetensors" "$REAL_NAME"
228
- log_success " Civitai modelo salvo como: $REAL_NAME"
229
- else
230
- mv "civitai_model_temp.safetensors" "civitai_2122278.safetensors"
231
- log_success " Civitai modelo salvo como: civitai_2122278.safetensors"
232
- fi
233
- fi
 
 
 
 
 
234
  ) &
235
  CIVITAI_PID=$!
236
 
237
- # [6/7] Instalar custom nodes (em paralelo)
238
- log_info "[6/7] Instalando custom nodes..."
 
 
 
 
 
 
239
  (
240
  set -Eeuo pipefail
241
  CN_DIR="$COMFY_DIR/custom_nodes"
242
 
 
 
 
 
 
 
243
  declare -A REPOS=(
244
- ["https://github.com/kijai/ComfyUI-Florence2"]="$CN_DIR/ComfyUI-Florence2"
245
- ["https://github.com/kijai/ComfyUI-WanVideoWrapper"]="$CN_DIR/ComfyUI-WanVideoWrapper"
246
- ["https://github.com/Fannovel16/ComfyUI-Frame-Interpolation"]="$CN_DIR/ComfyUI-Frame-Interpolation"
247
- ["https://github.com/kijai/ComfyUI-GIMM-VFI"]="$CN_DIR/ComfyUI-GIMM-VFI"
248
- ["https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"]="$CN_DIR/ComfyUI-VideoHelperSuite"
249
- ["https://github.com/kijai/ComfyUI-KJNodes"]="$CN_DIR/ComfyUI-KJNodes"
250
- ["https://github.com/Fannovel16/comfyui_controlnet_aux"]="$CN_DIR/comfyui_controlnet_aux"
251
- ["https://github.com/Artificial-Sweetener/comfyui-WhiteRabbit"]="$CN_DIR/comfyui-WhiteRabbit"
252
- ["https://github.com/LucipherDev/ComfyUI-AniDoc"]="$CN_DIR/ComfyUI-AniDoc"
253
- ["https://github.com/shiimizu/ComfyUI_smZNodes"]="$CN_DIR/ComfyUI_smZNodes"
254
- ["https://github.com/yuvraj108c/ComfyUI-Dwpose-Tensorrt"]="$CN_DIR/ComfyUI-Dwpose-Tensorrt"
255
- ["https://github.com/grmchn/ComfyUI-ProportionChanger"]="$CN_DIR/ComfyUI-ProportionChanger"
256
  )
257
 
258
  for url in "${!REPOS[@]}"; do
259
- clone_or_update "$url" "${REPOS[$url]}" &
 
 
260
  done
261
- wait
262
 
263
  log_success " Custom nodes instalados"
264
  ) &
265
  NODES_PID=$!
266
 
267
- # [7/7] Instalar SageAttention
268
- log_info "[7/7] Instalando SageAttention..."
269
  (
270
  set -Eeuo pipefail
271
 
@@ -275,43 +285,31 @@ log_info "[7/7] Instalando SageAttention..."
275
 
276
  python3 -m pip install --quiet "triton>=3.0.0" 2>/dev/null || true
277
 
278
- if [ -d "SageAttention" ]; then
279
- (cd SageAttention && git pull --ff-only --quiet)
280
- else
281
- git clone --depth 1 https://github.com/thu-ml/SageAttention.git --quiet
282
  fi
283
 
284
- cd SageAttention
285
- python3 setup.py install --quiet 2>/dev/null || {
286
- log_warn " SageAttention falhou, continuando sem ele"
287
  }
288
 
289
- log_success " SageAttention instalado"
 
 
 
 
 
290
  else
291
  log_warn " CUDA não detectado, pulando SageAttention"
292
  fi
293
  ) &
294
  SAGE_PID=$!
295
 
296
- # Aguardar todos os processos em paralelo
297
- log_info "Aguardando conclusão dos downloads e instalações..."
298
- echo -n " Progresso: "
299
-
300
- PIDS=($WAN_PID $CN_PID $CIVITAI_PID $NODES_PID $SAGE_PID)
301
- TOTAL=${#PIDS[@]}
302
- COMPLETED=0
303
-
304
- while [ $COMPLETED -lt $TOTAL ]; do
305
- COMPLETED=0
306
- for pid in "${PIDS[@]}"; do
307
- if ! kill -0 $pid 2>/dev/null; then
308
- ((COMPLETED++))
309
- fi
310
- done
311
- echo -ne "\r Progresso: [$COMPLETED/$TOTAL]"
312
- sleep 1
313
- done
314
- echo ""
315
 
316
  # Verificar instalação
317
  log_info "Verificando instalação..."
@@ -328,7 +326,11 @@ check_file() {
328
  fi
329
  }
330
 
 
 
 
331
  # Verificar modelos principais
 
332
  check_file "$MODELS_DIR/diffusion_models/wan2.2_fun_control_low_noise_14B_fp8_scaled.safetensors"
333
  check_file "$MODELS_DIR/diffusion_models/wan2.2_fun_control_high_noise_14B_fp8_scaled.safetensors"
334
  check_file "$MODELS_DIR/vae/wan_2.1_vae.safetensors"
@@ -336,6 +338,14 @@ check_file "$MODELS_DIR/text_encoders/umt5_xxl_fp16.safetensors"
336
  check_file "$MODELS_DIR/clip_vision/clip_vision_h.safetensors"
337
  check_file "$MODELS_DIR/controlnet/controlnet-union.safetensors"
338
 
 
 
 
 
 
 
 
 
339
  # Relatório final
340
  echo ""
341
  log_info "========================================="
@@ -347,13 +357,23 @@ if [ $ERROR_COUNT -eq 0 ]; then
347
  if python3 -c "import sageattention" 2>/dev/null; then
348
  SAGE_FLAG="--use-sage-attention"
349
  log_success "SageAttention disponível"
 
 
350
  fi
351
 
352
  echo ""
353
  log_info "Iniciando ComfyUI..."
354
- log_info "URL: http://$(hostname -I | awk '{print $1}'):$COMFY_PORT"
 
 
 
 
 
 
355
  echo ""
356
 
 
 
357
  exec comfy launch -- $SAGE_FLAG --listen "$COMFY_HOST" --port "$COMFY_PORT"
358
  else
359
  log_error "Instalação completada com $ERROR_COUNT erro(s)"
 
1
  #!/usr/bin/env bash
2
+ # setup_comfyui_wan22_fixed.sh
3
+ # Script corrigido para instalação do ComfyUI com Wan 2.2
4
  # Requisitos: Linux + Python3 + git + (opcional) NVCC/CUDA para SageAttention
5
 
6
  set -Eeuo pipefail
 
32
  REPO_21="Comfy-Org/Wan_2.1_ComfyUI_repackaged"
33
  REPO_CN="xinsir/controlnet-union-sdxl-1.0"
34
 
35
+ # Token do Civitai
36
  CIVITAI_TOKEN="${CIVITAI_TOKEN:-4fcb2834969399006a736ee402b061e5}"
37
 
38
  # Configurações de performance
 
51
  # -----------------------------
52
  # Setup inicial
53
  # -----------------------------
 
54
  TMPDL="$(mktemp -d)"
55
  cleanup() {
56
  log_info "Limpando arquivos temporários..."
 
73
  need wget
74
  need curl
75
 
 
 
 
 
 
 
76
  # -----------------------------
77
  # Funções auxiliares
78
  # -----------------------------
 
93
  fi
94
  }
95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  # -----------------------------
97
  # Instalação principal
98
  # -----------------------------
99
  echo ""
100
  log_info "========================================="
101
+ log_info " ComfyUI + Wan 2.2 Setup Corrigido"
102
  log_info " CPU Cores: $CPU_CORES | Jobs: $MAX_JOBS"
103
  log_info "========================================="
104
  echo ""
105
 
106
+ # [1/8] Atualizar pip e instalar ferramentas essenciais
107
+ log_info "[1/8] Atualizando pip e instalando ferramentas..."
108
+ python3 -m pip install --quiet --upgrade pip wheel setuptools >/dev/null 2>&1
109
  python3 -m pip install --quiet --upgrade comfy-cli "huggingface_hub>=0.23.0" hf_transfer aria2 >/dev/null 2>&1
110
  log_success "Ferramentas instaladas"
111
 
112
+ # [2/8] Instalar ComfyUI - SEMPRE PRIMEIRO!
113
+ log_info "[2/8] Instalando ComfyUI (GPU NVIDIA, fast deps)..."
114
+
115
+ # Verificação correta se ComfyUI já existe
116
+ if [ -f "$COMFY_DIR/main.py" ] && [ -d "$COMFY_DIR/models" ]; then
117
+ log_warn "ComfyUI já existe em $COMFY_DIR, pulando instalação base"
118
  else
119
+ log_info "Instalando ComfyUI em $COMFY_DIR..."
120
+ # Remove diretório parcialmente criado se existir
121
+ [ -d "$COMFY_DIR" ] && rm -rf "$COMFY_DIR"
122
+
123
+ # Instala ComfyUI
124
+ comfy --skip-prompt install --fast-deps --nvidia
125
+
126
+ # Verifica se instalou corretamente
127
+ if [ ! -f "$COMFY_DIR/main.py" ]; then
128
+ log_error "Falha na instalação do ComfyUI!"
129
+ exit 1
130
+ fi
131
  fi
 
132
 
133
+ # Criar estrutura de diretórios APÓS garantir que ComfyUI existe
134
+ MODELS_DIR="$COMFY_DIR/models"
135
+ log_info "Criando estrutura de diretórios..."
136
+ mkdir -p "$MODELS_DIR"/{diffusion_models,loras,vae,text_encoders,clip_vision,controlnet}
137
+ mkdir -p "$COMFY_DIR/custom_nodes"
138
+ mkdir -p "$TMPDL"/{wan22,wan21,controlnet}
139
+
140
+ log_success "ComfyUI pronto e estrutura criada"
141
+
142
+ # [3/8] Baixar modelos Wan 2.2
143
+ log_info "[3/8] Iniciando downloads dos modelos Wan 2.2..."
144
  (
145
  set -Eeuo pipefail
146
 
147
+ log_info " → Baixando Wan 2.2 models (isso pode demorar)..."
 
148
  huggingface-cli download "$REPO_22" \
149
  split_files/diffusion_models/wan2.2_fun_control_low_noise_14B_fp8_scaled.safetensors \
150
  split_files/diffusion_models/wan2.2_fun_control_high_noise_14B_fp8_scaled.safetensors \
 
154
  split_files/text_encoders/umt5_xxl_fp16.safetensors \
155
  --local-dir "$TMPDL/wan22" \
156
  --local-dir-use-symlinks False \
157
+ --resume-download
 
 
 
 
 
 
 
 
 
 
158
 
159
  # Copiar para destino
160
  cp -f "$TMPDL/wan22/split_files/diffusion_models/"*.safetensors "$MODELS_DIR/diffusion_models/" 2>/dev/null || true
161
  cp -f "$TMPDL/wan22/split_files/loras/"*.safetensors "$MODELS_DIR/loras/" 2>/dev/null || true
162
  cp -f "$TMPDL/wan22/split_files/vae/"*.safetensors "$MODELS_DIR/vae/" 2>/dev/null || true
163
  cp -f "$TMPDL/wan22/split_files/text_encoders/"*.safetensors "$MODELS_DIR/text_encoders/" 2>/dev/null || true
164
+
165
+ log_success " Modelos Wan 2.2 baixados"
166
+ ) &
167
+ WAN22_PID=$!
168
+
169
+ # [4/8] Baixar Wan 2.1 clip vision
170
+ log_info "[4/8] Baixando Wan 2.1 clip vision..."
171
+ (
172
+ set -Eeuo pipefail
173
+
174
+ log_info " → Baixando clip vision..."
175
+ huggingface-cli download "$REPO_21" \
176
+ split_files/clip_vision/clip_vision_h.safetensors \
177
+ --local-dir "$TMPDL/wan21" \
178
+ --local-dir-use-symlinks False \
179
+ --resume-download
180
+
181
  cp -f "$TMPDL/wan21/split_files/clip_vision/"*.safetensors "$MODELS_DIR/clip_vision/" 2>/dev/null || true
182
 
183
+ log_success " Clip vision baixado"
184
  ) &
185
+ WAN21_PID=$!
186
 
187
+ # [5/8] Baixar ControlNet
188
+ log_info "[5/8] Baixando ControlNet Union..."
189
  (
190
  set -Eeuo pipefail
191
+
192
  huggingface-cli download "$REPO_CN" \
193
  diffusion_pytorch_model_promax.safetensors \
194
  --local-dir "$TMPDL/controlnet" \
195
  --local-dir-use-symlinks False \
196
+ --resume-download
 
197
 
198
  cp -f "$TMPDL/controlnet/diffusion_pytorch_model_promax.safetensors" \
199
  "$MODELS_DIR/controlnet/controlnet-union.safetensors"
 
202
  ) &
203
  CN_PID=$!
204
 
205
+ # [6/8] Baixar modelo do Civitai
206
+ log_info "[6/8] Baixando modelo do Civitai..."
207
  (
208
  set -Eeuo pipefail
 
 
 
209
 
210
  cd "$MODELS_DIR/loras"
211
 
212
+ # URL correta sem aspas que quebram os parâmetros
213
+ CIVITAI_URL="https://civitai.com/api/download/models/2122278?type=Model&format=SafeTensor&size=pruned&fp=fp16&token=${CIVITAI_TOKEN}"
 
 
 
 
 
 
 
 
214
 
215
+ # Usar wget com content-disposition para pegar o nome correto
216
+ wget --content-disposition \
217
+ --tries=3 \
218
+ --timeout=60 \
219
+ --continue \
220
+ --progress=bar:force:noscroll \
221
+ "$CIVITAI_URL" 2>&1 | grep --line-buffered "%" | sed -u -e "s/^/ /" || {
222
+ log_warn " Tentando com curl como fallback..."
223
+ curl -L \
224
+ --retry 3 \
225
+ --connect-timeout 30 \
226
+ --progress-bar \
227
+ -o "flux_unleashed_v2.safetensors" \
228
+ "$CIVITAI_URL"
229
+ }
230
+
231
+ log_success " Modelo Civitai baixado"
232
  ) &
233
  CIVITAI_PID=$!
234
 
235
+ # [7/8] Aguardar downloads principais antes de instalar custom nodes
236
+ log_info "[7/8] Aguardando downloads principais..."
237
+ wait $WAN22_PID $WAN21_PID $CN_PID $CIVITAI_PID
238
+
239
+ # [8/8] Agora sim instalar custom nodes (ComfyUI já existe com certeza)
240
+ log_info "[8/8] Instalando custom nodes e SageAttention..."
241
+
242
+ # Custom nodes
243
  (
244
  set -Eeuo pipefail
245
  CN_DIR="$COMFY_DIR/custom_nodes"
246
 
247
+ # Verificar se o diretório existe
248
+ if [ ! -d "$CN_DIR" ]; then
249
+ log_error "Diretório custom_nodes não existe! Criando..."
250
+ mkdir -p "$CN_DIR"
251
+ fi
252
+
253
  declare -A REPOS=(
254
+ ["https://github.com/kijai/ComfyUI-Florence2"]="ComfyUI-Florence2"
255
+ ["https://github.com/kijai/ComfyUI-WanVideoWrapper"]="ComfyUI-WanVideoWrapper"
256
+ ["https://github.com/Fannovel16/ComfyUI-Frame-Interpolation"]="ComfyUI-Frame-Interpolation"
257
+ ["https://github.com/kijai/ComfyUI-GIMM-VFI"]="ComfyUI-GIMM-VFI"
258
+ ["https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"]="ComfyUI-VideoHelperSuite"
259
+ ["https://github.com/kijai/ComfyUI-KJNodes"]="ComfyUI-KJNodes"
260
+ ["https://github.com/Fannovel16/comfyui_controlnet_aux"]="comfyui_controlnet_aux"
261
+ ["https://github.com/Artificial-Sweetener/comfyui-WhiteRabbit"]="comfyui-WhiteRabbit"
262
+ ["https://github.com/LucipherDev/ComfyUI-AniDoc"]="ComfyUI-AniDoc"
263
+ ["https://github.com/shiimizu/ComfyUI_smZNodes"]="ComfyUI_smZNodes"
264
+ ["https://github.com/yuvraj108c/ComfyUI-Dwpose-Tensorrt"]="ComfyUI-Dwpose-Tensorrt"
265
+ ["https://github.com/grmchn/ComfyUI-ProportionChanger"]="ComfyUI-ProportionChanger"
266
  )
267
 
268
  for url in "${!REPOS[@]}"; do
269
+ node_name="${REPOS[$url]}"
270
+ node_path="$CN_DIR/$node_name"
271
+ clone_or_update "$url" "$node_path"
272
  done
 
273
 
274
  log_success " Custom nodes instalados"
275
  ) &
276
  NODES_PID=$!
277
 
278
+ # SageAttention
 
279
  (
280
  set -Eeuo pipefail
281
 
 
285
 
286
  python3 -m pip install --quiet "triton>=3.0.0" 2>/dev/null || true
287
 
288
+ # Clonar no diretório temporário primeiro
289
+ SAGE_DIR="$TMPDL/SageAttention"
290
+ if [ ! -d "$SAGE_DIR" ]; then
291
+ git clone --depth 1 https://github.com/thu-ml/SageAttention.git "$SAGE_DIR" --quiet
292
  fi
293
 
294
+ cd "$SAGE_DIR"
295
+ python3 setup.py install 2>/dev/null || {
296
+ log_warn " SageAttention falhou na compilação, continuando sem ele"
297
  }
298
 
299
+ # Testar se instalou
300
+ if python3 -c "import sageattention" 2>/dev/null; then
301
+ log_success " SageAttention instalado com sucesso"
302
+ else
303
+ log_warn " SageAttention não foi instalado corretamente"
304
+ fi
305
  else
306
  log_warn " CUDA não detectado, pulando SageAttention"
307
  fi
308
  ) &
309
  SAGE_PID=$!
310
 
311
+ # Aguardar custom nodes e SageAttention
312
+ wait $NODES_PID $SAGE_PID
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
 
314
  # Verificar instalação
315
  log_info "Verificando instalação..."
 
326
  fi
327
  }
328
 
329
+ # Verificar ComfyUI
330
+ check_file "$COMFY_DIR/main.py"
331
+
332
  # Verificar modelos principais
333
+ log_info "Verificando modelos baixados..."
334
  check_file "$MODELS_DIR/diffusion_models/wan2.2_fun_control_low_noise_14B_fp8_scaled.safetensors"
335
  check_file "$MODELS_DIR/diffusion_models/wan2.2_fun_control_high_noise_14B_fp8_scaled.safetensors"
336
  check_file "$MODELS_DIR/vae/wan_2.1_vae.safetensors"
 
338
  check_file "$MODELS_DIR/clip_vision/clip_vision_h.safetensors"
339
  check_file "$MODELS_DIR/controlnet/controlnet-union.safetensors"
340
 
341
+ # Verificar se algum modelo Civitai foi baixado
342
+ CIVITAI_COUNT=$(ls -1 "$MODELS_DIR/loras/"*.safetensors 2>/dev/null | wc -l)
343
+ if [ "$CIVITAI_COUNT" -gt 0 ]; then
344
+ log_success " ✓ $CIVITAI_COUNT modelo(s) Civitai encontrado(s)"
345
+ else
346
+ log_warn " ⚠ Nenhum modelo Civitai encontrado (não crítico)"
347
+ fi
348
+
349
  # Relatório final
350
  echo ""
351
  log_info "========================================="
 
357
  if python3 -c "import sageattention" 2>/dev/null; then
358
  SAGE_FLAG="--use-sage-attention"
359
  log_success "SageAttention disponível"
360
+ else
361
+ log_info "SageAttention não disponível (normal se não tiver CUDA)"
362
  fi
363
 
364
  echo ""
365
  log_info "Iniciando ComfyUI..."
366
+
367
+ # Tentar obter IP local
368
+ LOCAL_IP=$(hostname -I 2>/dev/null | awk '{print $1}')
369
+ if [ -n "$LOCAL_IP" ]; then
370
+ log_info "URL Local: http://$LOCAL_IP:$COMFY_PORT"
371
+ fi
372
+ log_info "URL: http://localhost:$COMFY_PORT"
373
  echo ""
374
 
375
+ # Mudar para o diretório do ComfyUI antes de executar
376
+ cd "$COMFY_DIR"
377
  exec comfy launch -- $SAGE_FLAG --listen "$COMFY_HOST" --port "$COMFY_PORT"
378
  else
379
  log_error "Instalação completada com $ERROR_COUNT erro(s)"