adbrasi commited on
Commit
d0e6bd6
·
verified ·
1 Parent(s): 0a2638d

Upload nsfw_videoGen2.sh

Browse files
Files changed (1) hide show
  1. nsfw_videoGen2.sh +690 -0
nsfw_videoGen2.sh ADDED
@@ -0,0 +1,690 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # setup_comfyui_wan22.sh
3
+ # Script baseado no CODE1 com modelos/nodes do CODE2 e melhorias de robustez
4
+
5
+ set -euo pipefail
6
+
7
+ # Cores para output
8
+ RED='\033[0;31m'
9
+ GREEN='\033[0;32m'
10
+ YELLOW='\033[1;33m'
11
+ BLUE='\033[0;34m'
12
+ NC='\033[0m'
13
+
14
+ log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
15
+ log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
16
+ log_warn() { echo -e "${YELLOW}[!]${NC} $1"; }
17
+ log_error() { echo -e "${RED}[✗]${NC} $1"; }
18
+
19
+ # Configuração
20
+ COMFY_DIR="${COMFY_DIR:-/root/comfy/ComfyUI}"
21
+ MODELS_DIR="$COMFY_DIR/models"
22
+ COMFY_HOST="${COMFY_HOST:-0.0.0.0}"
23
+ COMFY_PORT="${COMFY_PORT:-8818}"
24
+ CIVITAI_TOKEN="${CIVITAI_TOKEN:-}"
25
+ HF_TOKEN="${HF_TOKEN:-}"
26
+ VENV_DIR="${VENV_DIR:-/root/comfy/.venv}"
27
+
28
+ # Suprimir avisos do pip quando executado como root
29
+ export PIP_ROOT_USER_ACTION=ignore
30
+
31
+ # Performance
32
+ export MAX_JOBS="${MAX_JOBS:-32}"
33
+ export HF_HUB_ENABLE_HF_TRANSFER=1
34
+ export HF_TRANSFER_CONCURRENCY="${HF_TRANSFER_CONCURRENCY:-16}"
35
+ export NVCC_APPEND_FLAGS="${NVCC_APPEND_FLAGS:---threads 8}"
36
+ export PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
37
+
38
+ PYTHON_BIN=""
39
+
40
+ # Lista de downloads (formato: URL|TIPO|NOME_OPCIONAL)
41
+ DOWNLOAD_FILES=(
42
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-LOW_fp8_e4m3fn_scaled_KJ.safetensors|diffusion_models|"
43
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_2-I2V-A14B-HIGH_fp8_e4m3fn_scaled_KJ.safetensors|diffusion_models|"
44
+ "https://huggingface.co/jrewingwannabe/Wan2.2-Lightning_I2V-A14B-4steps-lora/resolve/main/Wan2.2-Lightning_I2V-A14B-4steps-lora_HIGH_fp16.safetensors|loras|"
45
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/LoRAs/Wan22_Lightx2v/Wan_2_2_I2V_A14B_HIGH_lightx2v_MoE_distill_lora_rank_64_bf16.safetensors|loras|"
46
+ "https://huggingface.co/jrewingwannabe/Wan2.2-Lightning_I2V-A14B-4steps-lora/resolve/main/Wan2.2-Lightning_I2V-A14B-4steps-lora_LOW_fp16.safetensors|loras|"
47
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors|vae|"
48
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/open-clip-xlm-roberta-large-vit-huge-14_visual_fp16.safetensors|clip_vision|"
49
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/umt5-xxl-enc-bf16.safetensors|text_encoders|"
50
+ "https://huggingface.co/ABDALLALSWAITI/Upscalers/resolve/main/general/Swin2SR_ClassicalSR_X2_64.pth|upscale_models|"
51
+ "https://huggingface.co/adbrasi/download_models/resolve/main/22-nsfw-HIGH-e6.safetensors|loras|"
52
+ "https://huggingface.co/adbrasi/download_models/resolve/main/NSFW-22-H-e8.safetensors|loras|"
53
+ "https://huggingface.co/adbrasi/download_models/resolve/main/NSFW-22-L-e8.safetensors|loras|"
54
+ "https://huggingface.co/adbrasi/download_models/resolve/main/smoothLoopv2_000002450_high_noise.safetensors|loras|"
55
+ "https://huggingface.co/adbrasi/download_models/resolve/main/smoothLoopv2_000002450_low_noise.safetensors|loras|"
56
+ "https://huggingface.co/adbrasi/download_models/resolve/main/ultimate_sex_000006500_high_noise.safetensors|loras|"
57
+ "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/audio_encoders/wav2vec2_large_english_fp16.safetensors|audio_encoders|"
58
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/InfiniteTalk/Wan2_1-InfiniteTalk-Single_fp8_e4m3fn_scaled_KJ.safetensors|diffusion_models|"
59
+ "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/clip_vision/clip_vision_h.safetensors|clip_vision|"
60
+ "https://huggingface.co/Kijai/WanVideo_comfy_fp8_scaled/resolve/main/I2V/Wan2_1-I2V-14B-720p_fp8_e4m3fn_scaled_KJ.safetensors|diffusion_models|"
61
+ "https://huggingface.co/adbrasi/download_models/resolve/main/ultimate_sex_000006500_low_noise.safetensors|loras|"
62
+ "https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Lightx2v/lightx2v_I2V_14B_480p_cfg_step_distill_rank256_bf16.safetensors|loras|"
63
+ "https://huggingface.co/Kijai/MelBandRoFormer_comfy/resolve/main/MelBandRoformer_fp16.safetensors|diffusion_models|"
64
+ "https://huggingface.co/lightx2v/Wan2.2-Distill-Loras/resolve/main/wan2.2_i2v_A14b_high_noise_lora_rank64_lightx2v_4step_1022.safetensors|loras|"
65
+ "https://huggingface.co/lightx2v/Wan2.2-Distill-Loras/resolve/main/wan2.2_i2v_A14b_low_noise_lora_rank64_lightx2v_4step_1022.safetensors|loras|"
66
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/x-ray_i2v_low.safetensors|loras|"
67
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/boorutaags.txt|loras|"
68
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/x-ray_i2v_high.safetensors|loras|"
69
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan22_i2v_futa_cowgirl_low_noise.safetensors|loras|"
70
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan22_i2v_futa_cowgirl_high_noise.safetensors|loras|"
71
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan22.r3v3rs3_c0wg1rl-14b-Low-i2v_e70.safetensors|loras|"
72
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan22.r3v3rs3_c0wg1rl-14b-High-i2v_e70.safetensors|loras|"
73
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan22-ultimatedeepthroat-i2v-102epoc-high-k3nk.safetensors|loras|"
74
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan2.2_i2v_lownoise_pov_missionary_v1.0.safetensors|loras|"
75
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan2.2_i2v_highnoise_pov_missionary_v1.0.safetensors|loras|"
76
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/st0m4chBulg3_FUSED_LN.safetensors|loras|"
77
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/st0m4chBulg3_FUSED_HN.safetensors|loras|"
78
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/slop_twerk_LowNoise_merged3_7_v2.safetensors|loras|"
79
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/slop_twerk_HighNoise_merged3_7_v2.safetensors|loras|"
80
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/reverse_suspended_congress_I2V_low.safetensors|loras|"
81
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/reverse_suspended_congress_I2V_high.safetensors|loras|"
82
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/pworship_low_noise.safetensors|loras|"
83
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/pworship_high_noise.safetensors|loras|"
84
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/mating_press_low.safetensors|loras|"
85
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/mating_press_high.safetensors|loras|"
86
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/livewallpaper_wan22_14b_i2v_low_model_0_1_e26.safetensors|loras|"
87
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/huge-titfuck-low.safetensors|loras|"
88
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/huge-titfuck-high.safetensors|loras|"
89
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/Wan22_I2V_Jacko_Pose_j4ck0_HIGH.safetensors|loras|"
90
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/WAN22_LowNoise_TransTwerk.safetensors|loras|"
91
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/WAN22_HighNoise_TransTwerk.safetensors|loras|"
92
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/WAN-2.2-I2V-Handjob-LOW-v1.safetensors|loras|"
93
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/WAN-2.2-I2V-Handjob-HIGH-v1.safetensors|loras|"
94
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/livewallpaper_wan22_14b_i2v_low_model_0_1_e26.safetensors|loras|livewallpaper_wan22_14b_i2v_low_model_0_1_e26.safetensors"
95
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/DR34MJOB_I2V_14b_LowNoise.safetensors|loras|"
96
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/DR34MJOB_I2V_14b_HighNoise.safetensors|loras|"
97
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/wan22-ultimatedeepthroat-I2V-101epoc-low-k3nk.safetensors|loras|"
98
+
99
+
100
+ # Qwen
101
+ "https://civitai.com/api/download/models/1828803?type=Model&format=SafeTensor&size=full&fp=fp16|checkpoints|"
102
+
103
+ "https://huggingface.co/Comfy-Org/Qwen-Image-Edit_ComfyUI/resolve/main/split_files/diffusion_models/qwen_image_edit_2509_fp8_e4m3fn.safetensors|diffusion_models|qwen_image_edit_2509_fp8_e4m3fn.safetensors"
104
+
105
+ "https://huggingface.co/Comfy-Org/Qwen-Image_ComfyUI/resolve/main/split_files/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors|text_encoders|qwen_2.5_vl_7b_fp8_scaled.safetensors"
106
+ "https://huggingface.co/Comfy-Org/Qwen-Image_ComfyUI/resolve/main/split_files/vae/qwen_image_vae.safetensors|vae|qwen_image_vae.safetensors"
107
+
108
+ "https://huggingface.co/lightx2v/Qwen-Image-Lightning/resolve/main/Qwen-Image-fp8-e4m3fn-Lightning-4steps-V1.0-fp32.safetensors|loras|Qwen-Image-fp8-e4m3fn-Lightning-4steps-V1.0-fp32.safetensors"
109
+ "https://huggingface.co/lightx2v/Qwen-Image-Lightning/resolve/main/Qwen-Image-Lightning-8steps-V2.0.safetensors|loras|Qwen-Image-Lightning-8steps-V2.0.safetensors"
110
+ "https://huggingface.co/lovis93/next-scene-qwen-image-lora-2509/resolve/main/next-scene_lora-v2-3000.safetensors|loras|next-scene_lora-v2-3000.safetensors"
111
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/multiangleQWEN.safetensors|loras|Qwen-Edit-2509-Multiple-angles.safetensors"
112
+
113
+
114
+ "https://civitai.com/api/download/models/1818185?type=Model&format=SafeTensor|loras|"
115
+ "https://civitai.com/api/download/models/2295041?type=Model&format=SafeTensor|loras|"
116
+ "https://civitai.com/api/download/models/1245271?type=Model&format=SafeTensor|loras|"
117
+ "https://civitai.com/api/download/models/2310692?type=Model&format=SafeTensor|loras|"
118
+ "https://civitai.com/api/download/models/1164079?type=Model&format=SafeTensor|loras|"
119
+ "https://civitai.com/api/download/models/1031892?type=Model&format=SafeTensor|loras|"
120
+ "https://civitai.com/api/download/models/1452729?type=Model&format=SafeTensor|loras|"
121
+ "https://civitai.com/api/download/models/1969737?type=Model&format=SafeTensor|loras|"
122
+ "https://civitai.com/api/download/models/1941518?type=Model&format=SafeTensor|loras|"
123
+ "https://civitai.com/api/download/models/1941518?type=Model&format=SafeTensor|loras|"
124
+ "https://civitai.com/api/download/models/1431530?type=Model&format=SafeTensor|loras|"
125
+ "https://civitai.com/api/download/models/1777446?type=Model&format=SafeTensor|loras|"
126
+ "https://civitai.com/api/download/models/1565457?type=Model&format=SafeTensor|loras|"
127
+ "https://civitai.com/api/download/models/2326498?type=Model&format=SafeTensor|loras|"
128
+ "https://civitai.com/api/download/models/938035?type=Model&format=SafeTensor|loras|"
129
+ "https://civitai.com/api/download/models/1444623?type=Model&format=SafeTensor|loras|"
130
+ "https://civitai.com/api/download/models/1295936?type=Model&format=SafeTensor|loras|"
131
+ "https://civitai.com/api/download/models/2068919?type=Model&format=SafeTensor|loras|"
132
+ "https://civitai.com/api/download/models/1280931?type=Model&format=SafeTensor|loras|"
133
+ "https://civitai.com/api/download/models/2238110?type=Model&format=SafeTensor|loras|"
134
+ "https://civitai.com/api/download/models/1453075?type=Model&format=SafeTensor|loras|"
135
+ "https://civitai.com/api/download/models/1630029?type=Model&format=SafeTensor|loras|"
136
+ "https://civitai.com/api/download/models/2296528?type=Model&format=SafeTensor|loras|"
137
+ "https://civitai.com/api/download/models/1268294?type=Model&format=SafeTensor|loras|"
138
+ "https://civitai.com/api/download/models/1148809?type=Model&format=SafeTensor|loras|"
139
+ "https://civitai.com/api/download/models/1715330?type=Model&format=SafeTensor|loras|"
140
+ "https://civitai.com/api/download/models/1715330?type=Model&format=SafeTensor|loras|"
141
+ "https://civitai.com/api/download/models/1499397?type=Model&format=SafeTensor|loras|"
142
+ "https://civitai.com/api/download/models/1779002?type=Model&format=SafeTensor|loras|"
143
+ "https://civitai.com/api/download/models/1114313?type=Model&format=SafeTensor|loras|"
144
+ "https://civitai.com/api/download/models/1780244?type=Model&format=SafeTensor|loras|"
145
+ "https://civitai.com/api/download/models/1613410?type=Model&format=SafeTensor|loras|"
146
+ "https://civitai.com/api/download/models/1804885?type=Model&format=SafeTensor|loras|"
147
+ "https://civitai.com/api/download/models/1809575?type=Model&format=SafeTensor|loras|"
148
+ "https://civitai.com/api/download/models/2135873?type=Model&format=SafeTensor|loras|"
149
+ "https://civitai.com/api/download/models/2332149?type=Model&format=SafeTensor|loras|"
150
+ "https://civitai.com/api/download/models/1517104?type=Model&format=SafeTensor|loras|"
151
+ "https://civitai.com/api/download/models/1112990?type=Model&format=SafeTensor|loras|"
152
+ "https://civitai.com/api/download/models/1379428?type=Model&format=SafeTensor|loras|"
153
+ "https://civitai.com/api/download/models/1755071?type=Model&format=SafeTensor|loras|"
154
+ "https://civitai.com/api/download/models/2298959?type=Model&format=SafeTensor|loras|"
155
+ "https://civitai.com/api/download/models/1936647?type=Model&format=SafeTensor|loras|"
156
+ "https://civitai.com/api/download/models/1583448?type=Model&format=SafeTensor|loras|"
157
+ "https://civitai.com/api/download/models/1873259?type=Model&format=SafeTensor|loras|"
158
+ "https://civitai.com/api/download/models/1570568?type=Model&format=SafeTensor|loras|"
159
+ "https://civitai.com/api/download/models/1563658?type=Model&format=SafeTensor|loras|"
160
+ "https://civitai.com/api/download/models/1445868?type=Model&format=SafeTensor|loras|"
161
+ "https://civitai.com/api/download/models/1415706?type=Model&format=SafeTensor|loras|"
162
+ "https://civitai.com/api/download/models/1373187?type=Model&format=SafeTensor|loras|"
163
+ "https://civitai.com/api/download/models/2066157?type=Model&format=SafeTensor|loras|"
164
+ "https://civitai.com/api/download/models/1741819?type=Model&format=SafeTensor|loras|"
165
+ "https://civitai.com/api/download/models/1833157?type=Model&format=SafeTensor|embeddings|"
166
+
167
+ "https://huggingface.co/Anzhc/Anzhcs_YOLOs/resolve/main/Anzhc%20Face%20seg%201024%20v2%20y8n.pt|ultralytics/bbox|Anzhc_Faceseg_1024_v2_y8n.pt"
168
+ "https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth|sams|sam_vit_b_01ec64.pth"
169
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/Eyeful_v2-Individual.pt|ultralytics/bbox|Eyeful_v2-Paired.pt"
170
+ "https://huggingface.co/Bingsu/adetailer/resolve/main/hand_yolov8s.pt|ultralytics/bbox|hand_yolov8s.pt"
171
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/ntd11_anime_nsfw_segm_v5-variant1.pt|ultralytics/bbox|ntd11_anime_nsfw_segm_v5-variant1.pt"
172
+ "https://civitai.com/api/download/models/2121199?type=Model&format=Other|embeddings|"
173
+ "https://civitai.com/api/download/models/1195487?type=Negative&format=Other|embeddings|"
174
+ "https://civitai.com/api/download/models/1470551?type=Model&format=SafeTensor|embeddings|"
175
+ # Upscalers
176
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/2x-AnimeSharpV4_RCAN_fp16_op17.onnx|upscale_models|2x-AnimeSharpV4_RCAN_fp16_op17.onnx"
177
+ "https://huggingface.co/Kim2091/AnimeSharp/resolve/main/4x-AnimeSharp.pth|upscale_models|4x-AnimeSharp.pth"
178
+ "https://huggingface.co/adbrasi/wanlotest/resolve/main/2x-AnimeSharpV4_Fast_RCAN_PU.safetensors|upscale_models|2x-AnimeSharpV4_Fast_RCAN_PU.safetensors"
179
+ "https://huggingface.co/Kim2091/AnimeSharpV3/resolve/main/2x-AnimeSharpV3.pth|upscale_models|2x-AnimeSharpV3.pth"
180
+ "https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth"
181
+ "https://huggingface.co/Kim2091/UltraSharpV2/resolve/main/4x-UltraSharpV2.pth|upscale_models|4x-UltraSharpV2.pth"
182
+ "https://huggingface.co/Kim2091/UltraSharpV2/resolve/main/4x-UltraSharpV2_Lite.pth|upscale_models|4x-UltraSharpV2_Lite.pth"
183
+
184
+ # Ultralytics
185
+ "https://huggingface.co/adbrasi/testedownload/resolve/main/99coins_anime_girl_face_m_seg.pt|ultralytics/bbox|99coins_anime_girl_face_m_seg.pt"
186
+
187
+
188
+
189
+
190
+ )
191
+
192
+ # Custom nodes (do CODE2)
193
+ CUSTOM_NODES=(
194
+ "https://github.com/kijai/ComfyUI-Florence2"
195
+ "https://github.com/adbrasi/groqrouter"
196
+ "https://github.com/kijai/ComfyUI-WanVideoWrapper"
197
+ "https://github.com/Fannovel16/ComfyUI-Frame-Interpolation"
198
+ "https://github.com/kijai/ComfyUI-GIMM-VFI"
199
+ "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"
200
+ "https://github.com/kijai/ComfyUI-KJNodes"
201
+ "https://github.com/Artificial-Sweetener/comfyui-WhiteRabbit"
202
+ "https://github.com/shiimizu/ComfyUI_smZNodes"
203
+ "https://github.com/CoreyCorza/ComfyUI-CRZnodes"
204
+ "https://github.com/pythongosssss/ComfyUI-Custom-Scripts"
205
+ "https://github.com/pythongosssss/ComfyUI-WD14-Tagger"
206
+ "https://github.com/WASasquatch/was-node-suite-comfyui"
207
+ "https://github.com/justUmen/Bjornulf_custom_nodes"
208
+ "https://github.com/mingsky-ai/ComfyUI-MingNodes"
209
+ "https://github.com/adbrasi/upavidito"
210
+ "https://github.com/rgthree/rgthree-comfy"
211
+ "https://github.com/TinyTerra/ComfyUI_tinyterraNodes"
212
+ "https://github.com/yolain/ComfyUI-Easy-Use"
213
+ "https://github.com/wallish77/wlsh_nodes"
214
+ "https://github.com/raindrop313/ComfyUI-WanVideoStartEndFrames"
215
+ "https://github.com/MushroomFleet/DJZ-Nodes"
216
+ "https://github.com/kijai/ComfyUI-MelBandRoFormer"
217
+ "https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes"
218
+ "https://github.com/MoonGoblinDev/Civicomfy"
219
+ )
220
+
221
+ download_hf() {
222
+ local hf_path="$1"
223
+ local target_dir="$2"
224
+ local filename="$3"
225
+ local revision="${4:-}"
226
+
227
+ if [[ -z "$filename" ]]; then
228
+ filename="$(basename "${hf_path%%\?*}")"
229
+ fi
230
+
231
+ mkdir -p "$target_dir"
232
+ if [[ -f "$target_dir/$filename" ]]; then
233
+ local existing_size
234
+ existing_size=$(stat -c%s "$target_dir/$filename" 2>/dev/null || echo 0)
235
+ if [[ "$existing_size" -gt 1048576 ]]; then
236
+ log_success "Já existe: $filename"
237
+ return 0
238
+ fi
239
+ fi
240
+
241
+ local owner="${hf_path%%/*}"
242
+ local remainder="${hf_path#*/}"
243
+ if [[ "$owner" == "$hf_path" ]]; then
244
+ log_error "Caminho HuggingFace inválido: $hf_path"
245
+ return 1
246
+ fi
247
+
248
+ local repo_segment="${remainder%%/*}"
249
+ if [[ "$repo_segment" == "$remainder" ]]; then
250
+ log_error "Arquivo não especificado no caminho: $hf_path"
251
+ return 1
252
+ fi
253
+
254
+ remainder="${remainder#*/}"
255
+ if [[ -z "$remainder" ]]; then
256
+ log_error "Arquivo não especificado no caminho: $hf_path"
257
+ return 1
258
+ fi
259
+
260
+ if [[ "$repo_segment" == *@* ]]; then
261
+ if [[ -z "$revision" ]]; then
262
+ revision="${repo_segment#*@}"
263
+ fi
264
+ repo_segment="${repo_segment%@*}"
265
+ fi
266
+
267
+ local repo_id="$owner/$repo_segment"
268
+ local file_path="$remainder"
269
+ local attempt success temp_dir
270
+ for attempt in 1 2 3; do
271
+ temp_dir="$(mktemp -d)"
272
+ success=false
273
+
274
+ log_info "[HF] Tentativa $attempt/3: ${repo_id}/${file_path}${revision:+ @}${revision:+$revision}"
275
+
276
+ if command -v hf >/dev/null 2>&1; then
277
+ local hf_cmd=(hf download "$repo_id" "$file_path")
278
+ if [[ -n "$revision" ]]; then
279
+ hf_cmd+=(--revision "$revision")
280
+ fi
281
+ hf_cmd+=(--local-dir "$temp_dir" --quiet)
282
+ if [[ -n "$HF_TOKEN" ]]; then
283
+ hf_cmd+=(--token "$HF_TOKEN")
284
+ fi
285
+ if HF_HUB_ENABLE_HF_TRANSFER=1 "${hf_cmd[@]}"; then
286
+ success=true
287
+ fi
288
+ fi
289
+
290
+ if [[ "$success" == false ]]; then
291
+ local fallback_revision="${revision:-main}"
292
+ local direct_url="https://huggingface.co/${repo_id}/resolve/${fallback_revision}/${file_path}"
293
+ log_warn "[HF] Tentativa $attempt usando fallback HTTP"
294
+ if command -v aria2c >/dev/null 2>&1; then
295
+ local aria_cmd=(aria2c -c -s 16 -x 16 -k 1M --console-log-level=warn --summary-interval=10 --dir "$temp_dir" --out "$filename")
296
+ if [[ -n "$HF_TOKEN" ]]; then
297
+ aria_cmd+=(--header="Authorization: Bearer $HF_TOKEN")
298
+ fi
299
+ aria_cmd+=("$direct_url")
300
+ if "${aria_cmd[@]}"; then
301
+ success=true
302
+ fi
303
+ fi
304
+ if [[ "$success" == false ]] && command -v curl >/dev/null 2>&1; then
305
+ local curl_cmd=(curl -L -# -o "$temp_dir/$filename")
306
+ if [[ -n "$HF_TOKEN" ]]; then
307
+ curl_cmd+=(-H "Authorization: Bearer $HF_TOKEN")
308
+ fi
309
+ curl_cmd+=("$direct_url")
310
+ if "${curl_cmd[@]}"; then
311
+ success=true
312
+ fi
313
+ fi
314
+ if [[ "$success" == false ]] && command -v wget >/dev/null 2>&1; then
315
+ local wget_cmd=(wget -q --show-progress -c -O "$temp_dir/$filename")
316
+ if [[ -n "$HF_TOKEN" ]]; then
317
+ wget_cmd+=(--header="Authorization: Bearer $HF_TOKEN")
318
+ fi
319
+ wget_cmd+=("$direct_url")
320
+ if "${wget_cmd[@]}"; then
321
+ success=true
322
+ fi
323
+ fi
324
+ fi
325
+
326
+ if [[ "$success" == true ]]; then
327
+ local downloaded
328
+ downloaded="$(find "$temp_dir" -type f -name "$filename" -print -quit)"
329
+ if [[ -z "$downloaded" ]]; then
330
+ downloaded="$(find "$temp_dir" -type f -print -quit)"
331
+ fi
332
+ if [[ -n "$downloaded" ]]; then
333
+ mv "$downloaded" "$target_dir/$filename"
334
+ rm -rf "$temp_dir"
335
+ if [[ -s "$target_dir/$filename" ]]; then
336
+ log_success "Download concluído: $filename"
337
+ return 0
338
+ fi
339
+ log_warn "Arquivo vazio após download: $filename"
340
+ rm -f "$target_dir/$filename"
341
+ fi
342
+ fi
343
+
344
+ rm -rf "$temp_dir"
345
+ log_warn "Tentativa $attempt falhou para $filename"
346
+ sleep $((2 * attempt))
347
+ done
348
+
349
+ log_error "Falha ao baixar: $filename"
350
+ return 1
351
+ }
352
+
353
+
354
+ download_file() {
355
+ local url="$1"
356
+ local target_dir="$2"
357
+ local filename="$3"
358
+
359
+ if [[ "$url" == *"civitai.com/api/download"* ]] && [[ "$url" != *"token="* ]] && [[ -n "$CIVITAI_TOKEN" ]]; then
360
+ if [[ "$url" == *"?"* ]]; then
361
+ url="${url}&token=${CIVITAI_TOKEN}"
362
+ else
363
+ url="${url}?token=${CIVITAI_TOKEN}"
364
+ fi
365
+ fi
366
+ mkdir -p "$target_dir"
367
+
368
+ local final_name="$filename"
369
+ if [[ -z "$final_name" ]]; then
370
+ final_name="$(basename "${url%%\?*}")"
371
+ fi
372
+
373
+ if [[ -f "$target_dir/$final_name" ]]; then
374
+ local existing_size
375
+ existing_size=$(stat -c%s "$target_dir/$final_name" 2>/dev/null || echo 0)
376
+ if [[ "$existing_size" -gt 524288 ]]; then
377
+ log_success "Já existe: $final_name"
378
+ return 0
379
+ fi
380
+ fi
381
+
382
+ local attempt success
383
+ for attempt in 1 2 3; do
384
+ success=false
385
+ log_info "[DL] Tentativa $attempt/3: ${final_name}"
386
+ if command -v aria2c >/dev/null 2>&1; then
387
+ if aria2c -c -s 16 -x 16 -k 1M --console-log-level=warn --summary-interval=10 --dir "$target_dir" --out "$final_name" "$url"; then
388
+ success=true
389
+ fi
390
+ fi
391
+ if [[ "$success" == false ]] && command -v wget >/dev/null 2>&1; then
392
+ if wget -q --show-progress -c -O "$target_dir/$final_name" "$url"; then
393
+ success=true
394
+ fi
395
+ fi
396
+ if [[ "$success" == false ]] && command -v curl >/dev/null 2>&1; then
397
+ if curl -L -# -C - -o "$target_dir/$final_name" "$url"; then
398
+ success=true
399
+ fi
400
+ fi
401
+ if [[ "$success" == true ]]; then
402
+ if [[ -s "$target_dir/$final_name" ]]; then
403
+ log_success "Download concluído: $final_name"
404
+ return 0
405
+ fi
406
+ log_warn "Arquivo vazio após download: $final_name"
407
+ rm -f "$target_dir/$final_name"
408
+ fi
409
+ log_warn "Tentativa $attempt falhou para $final_name"
410
+ sleep $((2 * attempt))
411
+ done
412
+
413
+ log_error "Falha ao baixar: $final_name"
414
+ return 1
415
+ }
416
+
417
+ download_mega() {
418
+ local url="$1"
419
+ local target_dir="$2"
420
+
421
+ url="${url#mega://}"
422
+ mkdir -p "$target_dir"
423
+
424
+ if ! command -v megadl >/dev/null 2>&1; then
425
+ log_warn "megadl não encontrado; tente instalar megatools manualmente"
426
+ return 1
427
+ fi
428
+
429
+ local attempt
430
+ for attempt in 1 2 3; do
431
+ log_info "[MEGA] Tentativa $attempt/3"
432
+ local temp_dir
433
+ temp_dir="$(mktemp -d)"
434
+ if megadl --limit-speed 0 --path "$temp_dir" "$url"; then
435
+ local moved=0
436
+ while IFS= read -r -d '' file; do
437
+ if [[ ! -f "$file" ]]; then
438
+ continue
439
+ fi
440
+ local base
441
+ base="$(basename "$file")"
442
+ if [[ -f "$target_dir/$base" ]]; then
443
+ log_success "Já existe: $base"
444
+ else
445
+ if mv "$file" "$target_dir/$base"; then
446
+ log_success "Download Mega.nz concluído: $base"
447
+ else
448
+ log_warn "Falha ao mover $base para destino final"
449
+ continue
450
+ fi
451
+ fi
452
+ moved=1
453
+ done < <(find "$temp_dir" -type f -print0)
454
+
455
+ rm -rf "$temp_dir"
456
+ if (( moved )); then
457
+ return 0
458
+ fi
459
+ log_warn "[MEGA] Nenhum arquivo detectado após download"
460
+ sleep $((2 * attempt))
461
+ else
462
+ log_warn "Tentativa $attempt falhou para Mega.nz"
463
+ rm -rf "$temp_dir"
464
+ sleep $((2 * attempt))
465
+ fi
466
+ done
467
+
468
+ log_error "Falha ao baixar de Mega.nz: $url"
469
+ return 1
470
+ }
471
+
472
+
473
+
474
+ process_downloads() {
475
+ local failed=0
476
+ for entry in "${DOWNLOAD_FILES[@]}"; do
477
+ IFS='|' read -r raw_url type filename <<< "$entry"
478
+ local target_dir="$MODELS_DIR/$type"
479
+ mkdir -p "$target_dir"
480
+
481
+ if [[ "$raw_url" == mega://* ]]; then
482
+ if ! download_mega "$raw_url" "$target_dir"; then
483
+ ((failed++))
484
+ fi
485
+ elif [[ "$raw_url" == hf://* ]]; then
486
+ local hf_path="${raw_url#hf://}"
487
+ if ! download_hf "$hf_path" "$target_dir" "$filename"; then
488
+ ((failed++))
489
+ fi
490
+ elif [[ "$raw_url" == https://huggingface.co/* ]]; then
491
+ local sanitized_url="${raw_url%%\?*}"
492
+ local hf_relative="${sanitized_url#https://huggingface.co/}"
493
+ IFS='/' read -ra hf_parts <<< "$hf_relative"
494
+ if (( ${#hf_parts[@]} >= 4 )) && [[ "${hf_parts[2]}" == "resolve" || "${hf_parts[2]}" == "blob" || "${hf_parts[2]}" == "raw" ]]; then
495
+ local hf_owner="${hf_parts[0]}"
496
+ local hf_repo="${hf_parts[1]}"
497
+ local hf_revision="${hf_parts[3]}"
498
+ local start_index=4
499
+ local hf_file_path=""
500
+ for ((i=start_index; i<${#hf_parts[@]}; i++)); do
501
+ if [[ -n "$hf_file_path" ]]; then
502
+ hf_file_path+='/'
503
+ fi
504
+ hf_file_path+="${hf_parts[i]}"
505
+ done
506
+ if [[ -n "$hf_file_path" ]]; then
507
+ local hf_path_combined="${hf_owner}/${hf_repo}/${hf_file_path}"
508
+ if ! download_hf "$hf_path_combined" "$target_dir" "$filename" "$hf_revision"; then
509
+ ((failed++))
510
+ fi
511
+ else
512
+ if ! download_file "$raw_url" "$target_dir" "$filename"; then
513
+ ((failed++))
514
+ fi
515
+ fi
516
+ else
517
+ if ! download_file "$raw_url" "$target_dir" "$filename"; then
518
+ ((failed++))
519
+ fi
520
+ fi
521
+ else
522
+ if ! download_file "$raw_url" "$target_dir" "$filename"; then
523
+ ((failed++))
524
+ fi
525
+ fi
526
+ done
527
+
528
+ if (( failed > 0 )); then
529
+ return 1
530
+ fi
531
+ return 0
532
+ }
533
+
534
+ clone_repo() {
535
+ local url="$1"
536
+ local dest="$2"
537
+
538
+ local name
539
+ name="$(basename "$dest")"
540
+
541
+ if [[ -d "$dest/.git" ]]; then
542
+ if ! git -C "$dest" pull --ff-only --no-rebase >/dev/null 2>&1; then
543
+ log_warn "Falha ao atualizar $name"
544
+ else
545
+ log_success "Atualizado: $name"
546
+ fi
547
+ else
548
+ if ! git clone --depth 1 "$url" "$dest" >/dev/null 2>&1; then
549
+ log_warn "Falha ao clonar $name"
550
+ return
551
+ fi
552
+ log_success "Clonado: $name"
553
+ fi
554
+
555
+ if [[ -f "$dest/requirements.txt" ]]; then
556
+ if [[ -n "$PYTHON_BIN" ]]; then
557
+ if ! "$PYTHON_BIN" -m pip install -q -r "$dest/requirements.txt" >/dev/null 2>&1; then
558
+ log_warn "Falha ao instalar requirements de $name"
559
+ else
560
+ log_info "Dependências instaladas para $name"
561
+ fi
562
+ else
563
+ log_warn "PYTHON_BIN não definido; pulei requirements de $name"
564
+ fi
565
+ fi
566
+ }
567
+
568
+ # ========== INSTALAÇÃO ==========
569
+ log_info "========================================="
570
+ log_info " ComfyUI + Wan 2.2 Setup"
571
+ log_info "========================================="
572
+
573
+ # 1. Dependências
574
+ log_info "[1/7] Instalando dependências do sistema..."
575
+ if command -v apt-get >/dev/null 2>&1; then
576
+ apt-get update -qq || log_warn "apt-get update falhou; seguindo assim mesmo"
577
+ apt-get install -y -qq python3-venv aria2 megatools git wget curl || log_warn "apt-get install retornou erro"
578
+ else
579
+ log_warn "apt-get indisponível; certifique-se de que python3-venv, aria2, megatools, git, wget e curl estão instalados"
580
+ fi
581
+ log_success "Dependências do sistema tratadas"
582
+
583
+ # 2. Preparar ambiente virtual
584
+ log_info "[2/7] Preparando ambiente virtual..."
585
+ if [[ ! -d "$VENV_DIR/bin" ]]; then
586
+ python3 -m venv "$VENV_DIR"
587
+ log_success "Ambiente virtual criado em $VENV_DIR"
588
+ else
589
+ log_info "Ambiente virtual já existe em $VENV_DIR"
590
+ fi
591
+ . "$VENV_DIR/bin/activate"
592
+ PYTHON_BIN="$VENV_DIR/bin/python"
593
+
594
+ "$PYTHON_BIN" -m pip install -U pip wheel setuptools -q || log_warn "Falha na atualização do pip"
595
+ "$PYTHON_BIN" -m pip install -U "huggingface_hub==0.25.1" "hf_transfer>=0.1.6" comfy-cli -q || log_warn "Falha instalando huggingface_hub/comfy-cli"
596
+ log_success "Ambiente virtual pronto e comfy-cli instalado"
597
+
598
+ # 3. Instalar ComfyUI
599
+ log_info "[3/7] Instalando ComfyUI..."
600
+ if [[ -f "$COMFY_DIR/main.py" ]]; then
601
+ log_warn "ComfyUI já presente"
602
+ else
603
+ comfy --skip-prompt install --fast-deps --nvidia --version "0.3.65" || log_error "Instalação do ComfyUI falhou"
604
+ fi
605
+
606
+ REQ_FILE="$COMFY_DIR/requirements.txt"
607
+ if [[ -f "$REQ_FILE" ]]; then
608
+ log_info "Verificando dependências do ComfyUI em: $REQ_FILE"
609
+ if [[ -n "$PYTHON_BIN" ]]; then
610
+ if "$PYTHON_BIN" -m pip install -q -r "$REQ_FILE"; then
611
+ log_success "Requirements do ComfyUI instalados/validados"
612
+ else
613
+ log_warn "Falha ao instalar requirements do ComfyUI; verifique o log acima e reexecute se necessário"
614
+ fi
615
+ else
616
+ log_warn "PYTHON_BIN não definido; pulei requirements do ComfyUI"
617
+ fi
618
+ else
619
+ log_warn "requirements.txt do ComfyUI não encontrado em $REQ_FILE"
620
+ fi
621
+
622
+ log_success "ComfyUI pronto"
623
+
624
+ # 4. Instalar PyTorch (CUDA 12.8)
625
+ log_info "[4/7] Instalando PyTorch CUDA 12.8..."
626
+ "$PYTHON_BIN" -m pip install --force --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128 || log_error "Falha ao instalar PyTorch"
627
+ log_success "PyTorch configurado"
628
+
629
+ # 5. Instalar SageAttention (condicional)
630
+ log_info "[5/7] Instalando SageAttention..."
631
+ if "$PYTHON_BIN" - <<'PY' >/dev/null 2>&1
632
+ import torch, sys
633
+ sys.exit(0 if torch.cuda.is_available() else 1)
634
+ PY
635
+ then
636
+ if "$PYTHON_BIN" -m pip install "https://huggingface.co/adbrasi/comfywheel/resolve/main/sageattention-2.2.0-cp312-cp312-linux_x86_64.whl" -q; then
637
+ if "$PYTHON_BIN" - <<'PY' >/dev/null 2>&1
638
+ import sageattention
639
+ PY
640
+ then
641
+ log_success "SageAttention instalado"
642
+ else
643
+ log_warn "SageAttention instalado, mas não pôde ser importado"
644
+ fi
645
+ else
646
+ log_warn "Falha ao instalar SageAttention"
647
+ fi
648
+ else
649
+ log_warn "CUDA indisponível; pulando SageAttention"
650
+ fi
651
+
652
+ # 6. Downloads de modelos
653
+ log_info "[6/7] Baixando modelos..."
654
+ mkdir -p "$MODELS_DIR"
655
+ if process_downloads; then
656
+ log_success "Downloads concluídos (ou já presentes)"
657
+ else
658
+ log_warn "Alguns downloads falharam; reexecute o script para tentar novamente"
659
+ fi
660
+
661
+ # 7. Custom nodes
662
+ log_info "[7/7] Instalando custom nodes..."
663
+ CN_DIR="$COMFY_DIR/custom_nodes"
664
+ mkdir -p "$CN_DIR"
665
+ node_total=${#CUSTOM_NODES[@]}
666
+ node_index=0
667
+ set +e
668
+ for repo in "${CUSTOM_NODES[@]}"; do
669
+ ((node_index++))
670
+ log_info "[$node_index/$node_total] $(basename "$repo")"
671
+ clone_repo "$repo" "$CN_DIR/$(basename "$repo")"
672
+ done
673
+ set -e
674
+ log_success "Custom nodes processados"
675
+
676
+
677
+ SAGE_FLAG=""
678
+ if "$PYTHON_BIN" - <<'PY' >/dev/null 2>&1
679
+ import sageattention
680
+ PY
681
+ then
682
+ SAGE_FLAG="--use-sage-attention"
683
+ fi
684
+
685
+ log_info "========================================="
686
+ log_info "Iniciando ComfyUI em http://${COMFY_HOST}:${COMFY_PORT}"
687
+ log_info "========================================="
688
+
689
+ cd "$COMFY_DIR"
690
+ exec comfy launch -- ${SAGE_FLAG:+$SAGE_FLAG} --preview-method latent2rgb --front-end-version Comfy-Org/[email protected] --listen "$COMFY_HOST" --port "$COMFY_PORT"