adbrasi commited on
Commit
546a048
verified
1 Parent(s): 7329201

Update wanForProduction.sh

Browse files
Files changed (1) hide show
  1. wanForProduction.sh +30 -25
wanForProduction.sh CHANGED
@@ -38,22 +38,6 @@ export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
38
  # Lista de downloads (formato: URL|TIPO|NOME_OPCIONAL)
39
  DOWNLOAD_FILES=(
40
  # Wan 2.2 principais (HF)
41
- "hf://Kijai/WanVideo_comfy/Wan22-Lightning/Wan2.2-Lightning_T2V-v1.1-A14B-4steps-lora_HIGH_fp16.safetensors|loras|Wan2.2-Lightning_T2V-v1.1-A14B-4steps-lora_HIGH_fp16.safetensors"
42
- "hf://Kijai/WanVideo_comfy/Wan22-Lightning/Wan2.2-Lightning_T2V-v1.1-A14B-4steps-lora_LOW_fp16.safetensors|loras|Wan2.2-Lightning_T2V-v1.1-A14B-4steps-lora_LOW_fp16.safetensors"
43
- "hf://Kijai/WanVideo_comfy_fp8_scaled/I2V/Wan2_2-I2V-A14B-HIGH_fp8_e5m2_scaled_KJ.safetensors|diffusion_models|Wan2_2-I2V-A14B-HIGH_fp8_e5m2_scaled_KJ.safetensors"
44
- "hf://Kijai/WanVideo_comfy_fp8_scaled/I2V/Wan2_2-I2V-A14B-LOW_fp8_e5m2_scaled_KJ.safetensors|diffusion_models|Wan2_2-I2V-A14B-LOW_fp8_e5m2_scaled_KJ.safetensors"
45
- "hf://Kijai/WanVideo_comfy/Wan22-Lightning/Wan2.2-Lightning_I2V-A14B-4steps-lora_HIGH_fp16.safetensors|loras|Wan2.2-Lightning_I2V-A14B-4steps-lora_HIGH_fp16.safetensors"
46
- "hf://Kijai/WanVideo_comfy/Wan22-Lightning/Wan2.2-Lightning_I2V-A14B-4steps-lora_LOW_fp16.safetensors|loras|Wan2.2-Lightning_I2V-A14B-4steps-lora_LOW_fp16.safetensors"
47
- "hf://Kijai/WanVideo_comfy/Wan2_1_VAE_fp32.safetensors|vae|Wan2_1_VAE_fp32.safetensors"
48
- "hf://Kijai/WanVideo_comfy/umt5-xxl-enc-bf16.safetensors|text_encoders|umt5-xxl-enc-bf16.safetensors"
49
- "hf://Kijai/WanVideo_comfy/Lightx2v/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors|loras|lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors"
50
- "hf://Comfy-Org/Wan_2.2_ComfyUI_Repackaged/split_files/vae/wan_2.1_vae.safetensors|vae|wan_2.1_vae.safetensors"
51
- "hf://Comfy-Org/Wan_2.2_ComfyUI_Repackaged/split_files/text_encoders/umt5_xxl_fp16.safetensors|text_encoders|umt5_xxl_fp16.safetensors"
52
- "hf://Kijai/WanVideo_comfy/open-clip-xlm-roberta-large-vit-huge-14_visual_fp32.safetensors|clip_vision|open-clip-xlm-roberta-large-vit-huge-14_visual_fp32.safetensors"
53
- "hf://Comfy-Org/Wan_2.1_ComfyUI_repackaged/split_files/clip_vision/clip_vision_h.safetensors|clip_vision|clip_vision_h.safetensors"
54
- "hf://ABDALLALSWAITI/Upscalers/anime/2x-AnimeSharpV2_MoSR_Soft.pth|upscale_models|2x-AnimeSharpV2_MoSR_Soft.pth"
55
-
56
- # Wan 2.2 extras (Mega.nz)
57
  "mega://https://mega.nz/file/QFxREJpZ#0dge8TyRgb52lMFKdsk-Ac-rwcoG49hvBHvaqNsZkuk|loras|"
58
  "mega://https://mega.nz/file/lIhQETjT#nKlQ01Euw6fUxo8P5bfwlQrxAkWEedXQQOqHv5u4yrM|loras|"
59
  "mega://https://mega.nz/file/UIAESACY#Qlei1Pj5Nwno3Sz-wsTekvD-YgCkN1A5QbFKoRHXG9E|loras|"
@@ -67,6 +51,15 @@ DOWNLOAD_FILES=(
67
  "mega://https://mega.nz/file/hZhhhCQS#4je0Im2g1kEvTCuPotjVWkA-g6XICkqMb-mKxMt6R3Y|loras|"
68
  "mega://https://mega.nz/file/qdQwAJSC#rPY2Hg4x-_RbHiHUBFW-YU8xZUqPpq5Gpl1uPFiJvW4|upscale_models|"
69
  "mega://https://mega.nz/file/KIh2marA#CehVNXxQhGfp1bqUL0K1YPWNqrCUoLPCZGq2W6XqmWo|upscale_models|"
 
 
 
 
 
 
 
 
 
70
  )
71
 
72
  # Custom nodes (do CODE2)
@@ -116,8 +109,12 @@ download_hf() {
116
  fi
117
  fi
118
 
119
- IFS='/' read -r owner repo rest <<< "$hf_path"
120
- if [[ -z "$owner" || -z "$repo" || -z "$rest" ]]; then
 
 
 
 
121
  log_error "Caminho HuggingFace inv谩lido: $hf_path"
122
  return 1
123
  fi
@@ -129,13 +126,13 @@ download_hf() {
129
  success=false
130
 
131
  if command -v hf >/dev/null 2>&1; then
132
- if HF_HUB_ENABLE_HF_TRANSFER=1 hf download "$repo_id" "$rest" --local-dir "$temp_dir" --quiet; then
133
  success=true
134
  fi
135
  fi
136
 
137
  if [[ "$success" == false ]]; then
138
- local direct_url="https://huggingface.co/${repo_id}/resolve/main/${rest}"
139
  if command -v aria2c >/dev/null 2>&1; then
140
  local aria_cmd=(aria2c -c -s 16 -x 16 -k 1M --console-log-level=warn --summary-interval=10 --dir "$temp_dir" --out "$filename")
141
  if [[ -n "$HF_TOKEN" ]]; then
@@ -174,8 +171,12 @@ download_hf() {
174
  if [[ -n "$downloaded" ]]; then
175
  mv "$downloaded" "$target_dir/$filename"
176
  rm -rf "$temp_dir"
177
- log_success "Download conclu铆do: $filename"
178
- return 0
 
 
 
 
179
  fi
180
  fi
181
 
@@ -235,8 +236,12 @@ download_file() {
235
  fi
236
  fi
237
  if [[ "$success" == true ]]; then
238
- log_success "Download conclu铆do: $final_name"
239
- return 0
 
 
 
 
240
  fi
241
  log_warn "Tentativa $attempt falhou para $final_name"
242
  sleep $((2 * attempt))
@@ -430,4 +435,4 @@ log_info "Iniciando ComfyUI em http://${COMFY_HOST}:${COMFY_PORT}"
430
  log_info "========================================="
431
 
432
  cd "$COMFY_DIR"
433
- exec comfy launch -- ${SAGE_FLAG:+$SAGE_FLAG} --listen "$COMFY_HOST" --port "$COMFY_PORT"
 
38
  # Lista de downloads (formato: URL|TIPO|NOME_OPCIONAL)
39
  DOWNLOAD_FILES=(
40
  # Wan 2.2 principais (HF)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  "mega://https://mega.nz/file/QFxREJpZ#0dge8TyRgb52lMFKdsk-Ac-rwcoG49hvBHvaqNsZkuk|loras|"
42
  "mega://https://mega.nz/file/lIhQETjT#nKlQ01Euw6fUxo8P5bfwlQrxAkWEedXQQOqHv5u4yrM|loras|"
43
  "mega://https://mega.nz/file/UIAESACY#Qlei1Pj5Nwno3Sz-wsTekvD-YgCkN1A5QbFKoRHXG9E|loras|"
 
51
  "mega://https://mega.nz/file/hZhhhCQS#4je0Im2g1kEvTCuPotjVWkA-g6XICkqMb-mKxMt6R3Y|loras|"
52
  "mega://https://mega.nz/file/qdQwAJSC#rPY2Hg4x-_RbHiHUBFW-YU8xZUqPpq5Gpl1uPFiJvW4|upscale_models|"
53
  "mega://https://mega.nz/file/KIh2marA#CehVNXxQhGfp1bqUL0K1YPWNqrCUoLPCZGq2W6XqmWo|upscale_models|"
54
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-LOW_fp8_e4m3fn_scaled_KJ.safetensors|diffusion_models|"
55
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-HIGH_fp8_e4m3fn_scaled_KJ.safetensors|diffusion_models|"
56
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/LoRAs/Wan22-Lightning/Wan22_A14B_T2V_HIGH_Lightning_4steps_lora_250928_rank128_fp16.safetensors|loras|"
57
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/LoRAs/Wan22-Lightning/Wan22_A14B_T2V_LOW_Lightning_4steps_lora_250928_rank64_fp16.safetensors|loras|"
58
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/LoRAs/AniSora/Wan2_2_I2V_AniSora_3_2_HIGH_rank_64_fp16.safetensors|loras|"
59
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors|vae|"
60
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/open-clip-xlm-roberta-large-vit-huge-14_visual_fp16.safetensors|clip_vision|"
61
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/umt5-xxl-enc-bf16.safetensors|text_encoders|"
62
+ "https://huggingface.co/ABDALLALSWAITI/Upscalers/resolve/main/general/Swin2SR_ClassicalSR_X2_64.pth|upscale_models|"
63
  )
64
 
65
  # Custom nodes (do CODE2)
 
109
  fi
110
  fi
111
 
112
+ local owner="${hf_path%%/*}"
113
+ local remainder="${hf_path#*/}"
114
+ local repo="${remainder%%/*}"
115
+ local file_path="${remainder#*/}"
116
+
117
+ if [[ -z "$owner" || -z "$repo" || -z "$file_path" || "$file_path" == "$remainder" ]]; then
118
  log_error "Caminho HuggingFace inv谩lido: $hf_path"
119
  return 1
120
  fi
 
126
  success=false
127
 
128
  if command -v hf >/dev/null 2>&1; then
129
+ if HF_HUB_ENABLE_HF_TRANSFER=1 hf download "$repo_id" "$file_path" --local-dir "$temp_dir" --quiet; then
130
  success=true
131
  fi
132
  fi
133
 
134
  if [[ "$success" == false ]]; then
135
+ local direct_url="https://huggingface.co/${repo_id}/resolve/main/${file_path}"
136
  if command -v aria2c >/dev/null 2>&1; then
137
  local aria_cmd=(aria2c -c -s 16 -x 16 -k 1M --console-log-level=warn --summary-interval=10 --dir "$temp_dir" --out "$filename")
138
  if [[ -n "$HF_TOKEN" ]]; then
 
171
  if [[ -n "$downloaded" ]]; then
172
  mv "$downloaded" "$target_dir/$filename"
173
  rm -rf "$temp_dir"
174
+ if [[ -s "$target_dir/$filename" ]]; then
175
+ log_success "Download conclu铆do: $filename"
176
+ return 0
177
+ fi
178
+ log_warn "Arquivo vazio ap贸s download: $filename"
179
+ rm -f "$target_dir/$filename"
180
  fi
181
  fi
182
 
 
236
  fi
237
  fi
238
  if [[ "$success" == true ]]; then
239
+ if [[ -s "$target_dir/$final_name" ]]; then
240
+ log_success "Download conclu铆do: $final_name"
241
+ return 0
242
+ fi
243
+ log_warn "Arquivo vazio ap贸s download: $final_name"
244
+ rm -f "$target_dir/$final_name"
245
  fi
246
  log_warn "Tentativa $attempt falhou para $final_name"
247
  sleep $((2 * attempt))
 
435
  log_info "========================================="
436
 
437
  cd "$COMFY_DIR"
438
+ exec comfy launch -- ${SAGE_FLAG:+$SAGE_FLAG} --listen "$COMFY_HOST" --port "$COMFY_PORT"