├── .dockerignore ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── LICENSE ├── README.md ├── cog.yaml ├── face-to-sticker-api.json ├── face-to-sticker-ui.json ├── helpers ├── ComfyUI_BRIA_AI_RMBG.py ├── ComfyUI_Controlnet_Aux.py ├── ComfyUI_IPAdapter_plus.py ├── ComfyUI_InstantID.py └── comfyui.py ├── predict.py ├── scripts ├── clone_plugins.sh ├── get_weights.py ├── package_disk_usage.py └── reset.sh ├── weights.json ├── weights_downloader.py ├── weights_licenses.md └── weights_manifest.py /.dockerignore: -------------------------------------------------------------------------------- 1 | **/__pycache__ 2 | **/.git 3 | **/.github 4 | **/.ci 5 | 6 | # Outputs 7 | *.jpg 8 | *.png 9 | *.gif 10 | *.mp4 11 | *.zip 12 | *.webp 13 | *.webm 14 | 15 | # Models 16 | *.ckpt 17 | *.safetensors 18 | *.pth 19 | *.bin 20 | *.onnx 21 | *.torchscript 22 | # .pt files are used by efficiency-nodes-comfyui 23 | 24 | # Files 25 | scripts/* 26 | updated_weights.json 27 | 28 | # Extension files 29 | *.ipynb 30 | *.bat 31 | 32 | # ComfyUI 33 | ComfyUI/venv 34 | ComfyUI/temp 35 | ComfyUI/user 36 | ComfyUI/models 37 | ComfyUI/custom_nodes/comfyUI_controlnet_aux/ckpts 38 | ComfyUI/custom_nodes/efficiency-nodes-comfyui/images 39 | 40 | # ComfyUI bits we just don’t need 41 | ComfyUI/tests 42 | ComfyUI/tests-ui 43 | ComfyUI/notebooks 44 | ComfyUI/script_examples 45 | ComfyUI/comfyui_screenshot.png 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.png 3 | *.jpg 4 | *.gif 5 | *.mp4 6 | *.zip 7 | *.ckpt 8 | *.safetensors 9 | *.pth 10 | *.bin 11 | *.torchscript 12 | weights.txt 13 | manifest.txt 14 | updated_weights.json 15 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ComfyUI"] 2 | path = ComfyUI 3 | url = https://github.com/comfyanonymous/ComfyUI.git 4 | commit = 37a86e4618098ef1e0d692d0953f072388cbc673 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2024-02-26 2 | 3 | - Fix: Always cancel and clear the ComfyUI server queue after a prediction 4 | - Add support for ComfyUI_Comfyroll_CustomNodes 5 | - Correctly download embeddings nested within prompt strings 6 | 7 | ## 2024-02-22 8 | 9 | - Add safetensor SDXL lightning checkpoints, UNETs and Loras 10 | 11 | ## 2024-02-21 12 | 13 | - Add SDXL lightning UNETs and Lora weights 14 | 15 | Models added: 16 | 17 | - sdxl_lightning_2step_lora.pth 18 | - sdxl_lightning_4step_lora.pth 19 | - sdxl_lightning_8step_lora.pth 20 | - sdxl_lightning_1step_unet_x0.pth 21 | - sdxl_lightning_2step_unet.pth 22 | - sdxl_lightning_4step_unet.pth 23 | - sdxl_lightning_8step_unet.pth 24 | - epicrealismXL_v10.safetensors 25 | - RealVisXL_V4.0.safetensors 26 | 27 | ## 2024-02-20 28 | 29 | - Add support for [WAS nodes](https://github.com/fofr/cog-comfyui/pull/25) 30 | - Add support for [comfyui-segment-anything](https://github.com/storyicon/comfyui_segment_anything) 31 | 32 | Models added: 33 | 34 | - mobile_sam.pt 35 | - sam_hq_vit_b.pth 36 | - sam_hq_vit_h.pth 37 | - sam_hq_vit_l.pth 38 | - groundingdino_swinb_cogcoor.pth 39 | - groundingdino_swint_ogc.pth 40 | - absolutereality_v181.safetensors 41 | - [PerfectEyesXL Lora](https://civitai.com/models/118427/perfect-eyes-xl) 42 | - [More details Lora](https://civitai.com/models/82098/add-more-details-detail-enhancer-tweaker-lora) 43 | - [FastNegative embedding](https://civitai.com/models/71961/fast-negative-embedding-fastnegativev2) 44 | 45 | ## 2024-02-17 46 | 47 | - Add support for [ComfyUI-Impact-Pack](https://github.com/fofr/cog-comfyui/pull/22) 48 | - Add ViT-H, ViT-L and ViT-B [segment anything models](https://github.com/facebookresearch/segment-anything) 49 | - Update [ComfyUI-AnimateDiff-Evolved](https://github.com/kosinkadink/ComfyUI-AnimateDiff-Evolved) to support Gen2 nodes (Fixes #19) 50 | 51 | ## 2024-02-14 52 | 53 | - Add support for [InstantID](https://github.com/cubiq/ComfyUI_InstantID) 54 | - Add support for [comfyui-reactor-nodes](https://github.com/Gourieff/comfyui-reactor-node) 55 | - Improve support for Insightface in ComfyUI_IPAdapter_plus 56 | - [Fix FaceID lora location](https://github.com/fofr/cog-comfyui/issues/15) 57 | 58 | Models added: 59 | 60 | - instantid-ipadapter.bin 61 | - instantid-controlnet.safetensors 62 | - antelopev2 63 | 64 | ## 2024-02-13 65 | 66 | - Disable metadata on saved outputs (#14 by @digitaljohn) 67 | - Add support for AIO_Preprocessor on ComfyUI_Controlnet_Aux 68 | - Allow passing of an already parsed JSON workflow (helpful when forking the repo to push new Replicate models) 69 | 70 | Models added: 71 | 72 | - [copaxTimelessxlSDXL1_v8.safetensors](https://civitai.com/models/118111?modelVersionId=198246) 73 | 74 | Loras added: 75 | 76 | - [MODILL_XL_0.27_RC.safetensors](https://civitai.com/models/192139/modillxl-modern-colorful-illustration-style-lora) 77 | 78 | ## 2024-02-09 79 | 80 | Models added: 81 | 82 | - [artificialguybr](https://huggingface.co/artificialguybr) LoRAs 83 | - [epicrealism_naturalSinRC1VAE.safetensors](https://civitai.com/models/25694/epicrealism) 84 | - [motionctrl_svd.ckpt](https://huggingface.co/TencentARC/MotionCtrl) 85 | - [sdxl_vae.safetensors](https://huggingface.co/stabilityai/sdxl-vae) 86 | 87 | Face restoration and detection models: 88 | 89 | - codeformer.pth 90 | - GFPGANv1.3.pth 91 | - GFPGANv1.4.pth 92 | - RestoreFormer.pth 93 | - detection_mobilenet0.25_Final.pth 94 | - detection_Resnet50_Final.pth 95 | - parsing_parsenet.pth 96 | - yolov5l-face.pth 97 | - yolov5n-face.pth 98 | 99 | ## 2024-01-23 100 | 101 | Models added: 102 | 103 | - [COOLKIDS_MERGE_V2.5.safetensors](https://civitai.com/models/60724/kids-illustration) 104 | - [dreamlabsoil_V2_v2.safetensors](https://civitai.com/models/50718/dreamlabsoilv2) 105 | 106 | Custom nodes added: 107 | 108 | - https://github.com/BadCafeCode/masquerade-nodes-comfyui 240209b 109 | 110 | ## 2024-01-22 111 | 112 | Models added: 113 | 114 | - photomaker-v1.bin 115 | - albedobaseXL_v13.safetensors 116 | - RealESRGAN_x4plus_anime_6B.pth 117 | - 4x_NMKD-Siax_200k.pth 118 | - 4x-UltraSharp.pth 119 | - [Harrlogos_v2.0.safetensors](https://civitai.com/models/176555/harrlogos-xl-finally-custom-text-generation-in-sd) 120 | - starlightXLAnimated_v3.safetensors 121 | 122 | Custom nodes added: 123 | 124 | - https://github.com/TinyTerra/ComfyUI_tinyterraNodes eda8a09 125 | - https://github.com/ssitu/ComfyUI_UltimateSDUpscale bcefc5b 126 | - https://github.com/cubiq/ComfyUI_essentials c9236fe 127 | - https://github.com/shiimizu/ComfyUI-PhotoMaker 75542a4 128 | - https://github.com/pythongosssss/ComfyUI-Custom-Scripts 9916c13 129 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | See also `weights_licenses.md`. 2 | 3 | Code: 4 | MIT License 5 | 6 | Copyright (c) 2024 fofr 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # face-to-sticker 2 | 3 | Turn any face into a sticker. 4 | 5 | Run this model on Replicate: 6 | 7 | https://replicate.com/fofr/face-to-sticker 8 | 9 | Or run it in ComfyUI: 10 | 11 | https://github.com/fofr/cog-face-to-sticker/blob/main/face-to-sticker-ui.json 12 | 13 | You’ll need these custom nodes: 14 | 15 | - [ComfyUI BRIA AI RMBG](https://github.com/ZHO-ZHO-ZHO/ComfyUI-BRIA_AI-RMBG/tree/44a3f8f) 16 | - [ComfyUI Controlnet Aux](https://github.com/Fannovel16/comfyui_controlnet_aux/tree/6d6f63c) 17 | - [ComfyUI InstantID](https://github.com/cubiq/ComfyUI_InstantID/tree/0fcf494) 18 | - [ComfyUI IPAdapter Plus](https://github.com/cubiq/ComfyUI_IPAdapter_plus/tree/4e898fe) 19 | - [ComfyUI UltimateSDUpscale](https://github.com/ssitu/ComfyUI_UltimateSDUpscale/tree/bcefc5b) 20 | - [Efficiency Nodes ComfyUI](https://github.com/jags111/efficiency-nodes-comfyui/tree/1ac5f18) 21 | 22 | ![Arnold](https://replicate.delivery/pbxt/RZzqVdLsqSZgHtEefD00iMK8VuDif6iVmXlSbNeiAShPuHtJB/ComfyUI_00002_.png) 23 | 24 | ## Developing locally 25 | 26 | Clone this repository: 27 | 28 | ```sh 29 | git clone --recurse-submodules https://github.com/fofr/cog-face-to-sticker.git 30 | ``` 31 | 32 | Run the [following script](https://github.com/fofr/cog-comfyui/blob/main/scripts/clone_plugins.sh) to install all the custom nodes: 33 | 34 | ```sh 35 | ./scripts/clone_plugins.sh 36 | ``` 37 | 38 | ### Running the Web UI from your Cog container 39 | 40 | 1. **GPU Machine**: Start the Cog container and expose port 8188: 41 | ```sh 42 | sudo cog run -p 8188 bash 43 | ``` 44 | Running this command starts up the Cog container and let's you access it 45 | 46 | 2. **Inside Cog Container**: Now that we have access to the Cog container, we start the server, binding to all network interfaces: 47 | ```sh 48 | cd ComfyUI/ 49 | python main.py --listen 0.0.0.0 50 | ``` 51 | 52 | 3. **Local Machine**: Access the server using the GPU machine's IP and the exposed port (8188): 53 | `http://:8188` 54 | 55 | When you goto `http://:8188` you'll see the classic ComfyUI web form! 56 | -------------------------------------------------------------------------------- /cog.yaml: -------------------------------------------------------------------------------- 1 | build: 2 | gpu: true 3 | cuda: "12.1" 4 | system_packages: 5 | - ffmpeg 6 | python_version: "3.10.6" 7 | python_packages: 8 | - torch 9 | - torchvision 10 | - torchaudio 11 | - torchsde 12 | - einops 13 | - transformers>=4.25.1 14 | - safetensors>=0.3.0 15 | - aiohttp 16 | - accelerate 17 | - pyyaml 18 | - Pillow 19 | - scipy 20 | - tqdm 21 | - psutil 22 | - websocket-client==1.6.3 23 | 24 | # comfyui-reactor-node 25 | - insightface 26 | - onnx 27 | 28 | # comfyui_controlnet_aux 29 | # https://github.com/Fannovel16/comfyui_controlnet_aux/blob/main/requirements.txt 30 | - importlib_metadata 31 | - opencv-python-headless>=4.0.1.24 32 | - filelock 33 | - numpy 34 | - einops 35 | - pyyaml 36 | - scikit-image 37 | - python-dateutil 38 | - mediapipe 39 | - svglib 40 | - fvcore 41 | - yapf 42 | - omegaconf 43 | - ftfy 44 | - addict 45 | - yacs 46 | - trimesh[easy] 47 | run: 48 | - curl -o /usr/local/bin/pget -L "https://github.com/replicate/pget/releases/download/v0.6.0/pget_linux_x86_64" && chmod +x /usr/local/bin/pget 49 | - pip install onnxruntime-gpu --extra-index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/onnxruntime-cuda-12/pypi/simple/ 50 | predict: "predict.py:Predictor" 51 | -------------------------------------------------------------------------------- /face-to-sticker-api.json: -------------------------------------------------------------------------------- 1 | { 2 | "2": { 3 | "inputs": { 4 | "ckpt_name": "albedobaseXL_v13.safetensors", 5 | "vae_name": "Baked VAE", 6 | "clip_skip": -1, 7 | "lora_name": "None", 8 | "lora_model_strength": 1, 9 | "lora_clip_strength": 1, 10 | "positive": "Sticker, scary zombie, cel shaded, svg, vector art, sharp", 11 | "negative": "open mouth, shiny, photo, photography, soft, nsfw, nude, ugly, broken, watermark, oversaturated", 12 | "token_normalization": "none", 13 | "weight_interpretation": "comfy", 14 | "empty_latent_width": 1024, 15 | "empty_latent_height": 1024, 16 | "batch_size": 1, 17 | "lora_stack": [ 18 | "3", 19 | 0 20 | ], 21 | "cnet_stack": [ 22 | "28", 23 | 0 24 | ] 25 | }, 26 | "class_type": "Efficient Loader", 27 | "_meta": { 28 | "title": "Efficient Loader" 29 | } 30 | }, 31 | "3": { 32 | "inputs": { 33 | "input_mode": "simple", 34 | "lora_count": 3, 35 | "lora_name_1": "artificialguybr/StickersRedmond.safetensors", 36 | "lora_wt_1": 1, 37 | "model_str_1": 1, 38 | "clip_str_1": 1, 39 | "lora_name_2": "None", 40 | "lora_wt_2": 1, 41 | "model_str_2": 1, 42 | "clip_str_2": 1, 43 | "lora_name_3": "None", 44 | "lora_wt_3": 1, 45 | "model_str_3": 1, 46 | "clip_str_3": 1, 47 | "lora_name_4": "None", 48 | "lora_wt_4": 1, 49 | "model_str_4": 1, 50 | "clip_str_4": 1, 51 | "lora_name_5": "None", 52 | "lora_wt_5": 1, 53 | "model_str_5": 1, 54 | "clip_str_5": 1, 55 | "lora_name_6": "None", 56 | "lora_wt_6": 1, 57 | "model_str_6": 1, 58 | "clip_str_6": 1, 59 | "lora_name_7": "None", 60 | "lora_wt_7": 1, 61 | "model_str_7": 1, 62 | "clip_str_7": 1, 63 | "lora_name_8": "None", 64 | "lora_wt_8": 1, 65 | "model_str_8": 1, 66 | "clip_str_8": 1, 67 | "lora_name_9": "None", 68 | "lora_wt_9": 1, 69 | "model_str_9": 1, 70 | "clip_str_9": 1, 71 | "lora_name_10": "None", 72 | "lora_wt_10": 1, 73 | "model_str_10": 1, 74 | "clip_str_10": 1, 75 | "lora_name_11": "None", 76 | "lora_wt_11": 1, 77 | "model_str_11": 1, 78 | "clip_str_11": 1, 79 | "lora_name_12": "None", 80 | "lora_wt_12": 1, 81 | "model_str_12": 1, 82 | "clip_str_12": 1, 83 | "lora_name_13": "None", 84 | "lora_wt_13": 1, 85 | "model_str_13": 1, 86 | "clip_str_13": 1, 87 | "lora_name_14": "None", 88 | "lora_wt_14": 1, 89 | "model_str_14": 1, 90 | "clip_str_14": 1, 91 | "lora_name_15": "None", 92 | "lora_wt_15": 1, 93 | "model_str_15": 1, 94 | "clip_str_15": 1, 95 | "lora_name_16": "None", 96 | "lora_wt_16": 1, 97 | "model_str_16": 1, 98 | "clip_str_16": 1, 99 | "lora_name_17": "None", 100 | "lora_wt_17": 1, 101 | "model_str_17": 1, 102 | "clip_str_17": 1, 103 | "lora_name_18": "None", 104 | "lora_wt_18": 1, 105 | "model_str_18": 1, 106 | "clip_str_18": 1, 107 | "lora_name_19": "None", 108 | "lora_wt_19": 1, 109 | "model_str_19": 1, 110 | "clip_str_19": 1, 111 | "lora_name_20": "None", 112 | "lora_wt_20": 1, 113 | "model_str_20": 1, 114 | "clip_str_20": 1, 115 | "lora_name_21": "None", 116 | "lora_wt_21": 1, 117 | "model_str_21": 1, 118 | "clip_str_21": 1, 119 | "lora_name_22": "None", 120 | "lora_wt_22": 1, 121 | "model_str_22": 1, 122 | "clip_str_22": 1, 123 | "lora_name_23": "None", 124 | "lora_wt_23": 1, 125 | "model_str_23": 1, 126 | "clip_str_23": 1, 127 | "lora_name_24": "None", 128 | "lora_wt_24": 1, 129 | "model_str_24": 1, 130 | "clip_str_24": 1, 131 | "lora_name_25": "None", 132 | "lora_wt_25": 1, 133 | "model_str_25": 1, 134 | "clip_str_25": 1, 135 | "lora_name_26": "None", 136 | "lora_wt_26": 1, 137 | "model_str_26": 1, 138 | "clip_str_26": 1, 139 | "lora_name_27": "None", 140 | "lora_wt_27": 1, 141 | "model_str_27": 1, 142 | "clip_str_27": 1, 143 | "lora_name_28": "None", 144 | "lora_wt_28": 1, 145 | "model_str_28": 1, 146 | "clip_str_28": 1, 147 | "lora_name_29": "None", 148 | "lora_wt_29": 1, 149 | "model_str_29": 1, 150 | "clip_str_29": 1, 151 | "lora_name_30": "None", 152 | "lora_wt_30": 1, 153 | "model_str_30": 1, 154 | "clip_str_30": 1, 155 | "lora_name_31": "None", 156 | "lora_wt_31": 1, 157 | "model_str_31": 1, 158 | "clip_str_31": 1, 159 | "lora_name_32": "None", 160 | "lora_wt_32": 1, 161 | "model_str_32": 1, 162 | "clip_str_32": 1, 163 | "lora_name_33": "None", 164 | "lora_wt_33": 1, 165 | "model_str_33": 1, 166 | "clip_str_33": 1, 167 | "lora_name_34": "None", 168 | "lora_wt_34": 1, 169 | "model_str_34": 1, 170 | "clip_str_34": 1, 171 | "lora_name_35": "None", 172 | "lora_wt_35": 1, 173 | "model_str_35": 1, 174 | "clip_str_35": 1, 175 | "lora_name_36": "None", 176 | "lora_wt_36": 1, 177 | "model_str_36": 1, 178 | "clip_str_36": 1, 179 | "lora_name_37": "None", 180 | "lora_wt_37": 1, 181 | "model_str_37": 1, 182 | "clip_str_37": 1, 183 | "lora_name_38": "None", 184 | "lora_wt_38": 1, 185 | "model_str_38": 1, 186 | "clip_str_38": 1, 187 | "lora_name_39": "None", 188 | "lora_wt_39": 1, 189 | "model_str_39": 1, 190 | "clip_str_39": 1, 191 | "lora_name_40": "None", 192 | "lora_wt_40": 1, 193 | "model_str_40": 1, 194 | "clip_str_40": 1, 195 | "lora_name_41": "None", 196 | "lora_wt_41": 1, 197 | "model_str_41": 1, 198 | "clip_str_41": 1, 199 | "lora_name_42": "None", 200 | "lora_wt_42": 1, 201 | "model_str_42": 1, 202 | "clip_str_42": 1, 203 | "lora_name_43": "None", 204 | "lora_wt_43": 1, 205 | "model_str_43": 1, 206 | "clip_str_43": 1, 207 | "lora_name_44": "None", 208 | "lora_wt_44": 1, 209 | "model_str_44": 1, 210 | "clip_str_44": 1, 211 | "lora_name_45": "None", 212 | "lora_wt_45": 1, 213 | "model_str_45": 1, 214 | "clip_str_45": 1, 215 | "lora_name_46": "None", 216 | "lora_wt_46": 1, 217 | "model_str_46": 1, 218 | "clip_str_46": 1, 219 | "lora_name_47": "None", 220 | "lora_wt_47": 1, 221 | "model_str_47": 1, 222 | "clip_str_47": 1, 223 | "lora_name_48": "None", 224 | "lora_wt_48": 1, 225 | "model_str_48": 1, 226 | "clip_str_48": 1, 227 | "lora_name_49": "None", 228 | "lora_wt_49": 1, 229 | "model_str_49": 1, 230 | "clip_str_49": 1 231 | }, 232 | "class_type": "LoRA Stacker", 233 | "_meta": { 234 | "title": "LoRA Stacker" 235 | } 236 | }, 237 | "4": { 238 | "inputs": { 239 | "seed": 32966725480658, 240 | "steps": 20, 241 | "cfg": 7, 242 | "sampler_name": "dpmpp_2m_sde", 243 | "scheduler": "karras", 244 | "denoise": 1, 245 | "preview_method": "none", 246 | "vae_decode": "true", 247 | "model": [ 248 | "43", 249 | 0 250 | ], 251 | "positive": [ 252 | "41", 253 | 1 254 | ], 255 | "negative": [ 256 | "41", 257 | 2 258 | ], 259 | "latent_image": [ 260 | "2", 261 | 3 262 | ], 263 | "optional_vae": [ 264 | "2", 265 | 4 266 | ] 267 | }, 268 | "class_type": "KSampler (Efficient)", 269 | "_meta": { 270 | "title": "KSampler (Efficient)" 271 | } 272 | }, 273 | "5": { 274 | "inputs": { 275 | "filename_prefix": "ComfyUI", 276 | "images": [ 277 | "4", 278 | 5 279 | ] 280 | }, 281 | "class_type": "SaveImage", 282 | "_meta": { 283 | "title": "Save Image" 284 | } 285 | }, 286 | "8": { 287 | "inputs": {}, 288 | "class_type": "BRIA_RMBG_ModelLoader_Zho", 289 | "_meta": { 290 | "title": "🧹BRIA_RMBG Model Loader" 291 | } 292 | }, 293 | "9": { 294 | "inputs": { 295 | "rmbgmodel": [ 296 | "8", 297 | 0 298 | ], 299 | "image": [ 300 | "4", 301 | 5 302 | ] 303 | }, 304 | "class_type": "BRIA_RMBG_Zho", 305 | "_meta": { 306 | "title": "🧹BRIA RMBG" 307 | } 308 | }, 309 | "10": { 310 | "inputs": { 311 | "filename_prefix": "ComfyUI", 312 | "images": [ 313 | "9", 314 | 0 315 | ] 316 | }, 317 | "class_type": "SaveImage", 318 | "_meta": { 319 | "title": "Save Image" 320 | } 321 | }, 322 | "11": { 323 | "inputs": { 324 | "upscale_by": 2, 325 | "seed": 786855515709664, 326 | "steps": 10, 327 | "cfg": 8, 328 | "sampler_name": "euler", 329 | "scheduler": "normal", 330 | "denoise": 0.2, 331 | "mode_type": "Linear", 332 | "tile_width": 512, 333 | "tile_height": 512, 334 | "mask_blur": 8, 335 | "tile_padding": 32, 336 | "seam_fix_mode": "None", 337 | "seam_fix_denoise": 1, 338 | "seam_fix_width": 64, 339 | "seam_fix_mask_blur": 8, 340 | "seam_fix_padding": 16, 341 | "force_uniform_tiles": true, 342 | "tiled_decode": false, 343 | "image": [ 344 | "4", 345 | 5 346 | ], 347 | "model": [ 348 | "12", 349 | 0 350 | ], 351 | "positive": [ 352 | "13", 353 | 0 354 | ], 355 | "negative": [ 356 | "14", 357 | 0 358 | ], 359 | "vae": [ 360 | "12", 361 | 2 362 | ], 363 | "upscale_model": [ 364 | "15", 365 | 0 366 | ] 367 | }, 368 | "class_type": "UltimateSDUpscale", 369 | "_meta": { 370 | "title": "Ultimate SD Upscale" 371 | } 372 | }, 373 | "12": { 374 | "inputs": { 375 | "ckpt_name": "dreamshaper_8.safetensors" 376 | }, 377 | "class_type": "CheckpointLoaderSimple", 378 | "_meta": { 379 | "title": "Load Checkpoint" 380 | } 381 | }, 382 | "13": { 383 | "inputs": { 384 | "text": "svg, vector art, sharp", 385 | "clip": [ 386 | "12", 387 | 1 388 | ] 389 | }, 390 | "class_type": "CLIPTextEncode", 391 | "_meta": { 392 | "title": "CLIP Text Encode (Prompt)" 393 | } 394 | }, 395 | "14": { 396 | "inputs": { 397 | "text": "nsfw, photo, photography, watermark", 398 | "clip": [ 399 | "12", 400 | 1 401 | ] 402 | }, 403 | "class_type": "CLIPTextEncode", 404 | "_meta": { 405 | "title": "CLIP Text Encode (Prompt)" 406 | } 407 | }, 408 | "15": { 409 | "inputs": { 410 | "model_name": "4x-AnimeSharp.pth" 411 | }, 412 | "class_type": "UpscaleModelLoader", 413 | "_meta": { 414 | "title": "Load Upscale Model" 415 | } 416 | }, 417 | "16": { 418 | "inputs": { 419 | "filename_prefix": "ComfyUI", 420 | "images": [ 421 | "11", 422 | 0 423 | ] 424 | }, 425 | "class_type": "SaveImage", 426 | "_meta": { 427 | "title": "Save Image" 428 | } 429 | }, 430 | "17": { 431 | "inputs": { 432 | "rmbgmodel": [ 433 | "8", 434 | 0 435 | ], 436 | "image": [ 437 | "11", 438 | 0 439 | ] 440 | }, 441 | "class_type": "BRIA_RMBG_Zho", 442 | "_meta": { 443 | "title": "🧹BRIA RMBG" 444 | } 445 | }, 446 | "18": { 447 | "inputs": { 448 | "filename_prefix": "ComfyUI", 449 | "images": [ 450 | "17", 451 | 0 452 | ] 453 | }, 454 | "class_type": "SaveImage", 455 | "_meta": { 456 | "title": "Save Image" 457 | } 458 | }, 459 | "22": { 460 | "inputs": { 461 | "image": "0_1.webp", 462 | "upload": "image" 463 | }, 464 | "class_type": "LoadImage", 465 | "_meta": { 466 | "title": "Load Image" 467 | } 468 | }, 469 | "24": { 470 | "inputs": { 471 | "control_net_name": "depth-zoe-xl-v1.0-controlnet.safetensors" 472 | }, 473 | "class_type": "ControlNetLoader", 474 | "_meta": { 475 | "title": "Load ControlNet Model" 476 | } 477 | }, 478 | "25": { 479 | "inputs": { 480 | "preprocessor": "Zoe-DepthMapPreprocessor", 481 | "resolution": 1024, 482 | "image": [ 483 | "22", 484 | 0 485 | ] 486 | }, 487 | "class_type": "AIO_Preprocessor", 488 | "_meta": { 489 | "title": "AIO Aux Preprocessor" 490 | } 491 | }, 492 | "28": { 493 | "inputs": { 494 | "strength": 0.2, 495 | "start_percent": 0, 496 | "end_percent": 0.7000000000000001, 497 | "control_net": [ 498 | "24", 499 | 0 500 | ], 501 | "image": [ 502 | "25", 503 | 0 504 | ] 505 | }, 506 | "class_type": "Control Net Stacker", 507 | "_meta": { 508 | "title": "Control Net Stacker" 509 | } 510 | }, 511 | "35": { 512 | "inputs": { 513 | "instantid_file": "instantid-ip-adapter.bin" 514 | }, 515 | "class_type": "InstantIDModelLoader", 516 | "_meta": { 517 | "title": "Load InstantID Model" 518 | } 519 | }, 520 | "36": { 521 | "inputs": { 522 | "provider": "CPU" 523 | }, 524 | "class_type": "InstantIDFaceAnalysis", 525 | "_meta": { 526 | "title": "InstantID Face Analysis" 527 | } 528 | }, 529 | "40": { 530 | "inputs": { 531 | "control_net_name": "instantid-controlnet.safetensors" 532 | }, 533 | "class_type": "ControlNetLoader", 534 | "_meta": { 535 | "title": "Load ControlNet Model" 536 | } 537 | }, 538 | "41": { 539 | "inputs": { 540 | "weight": 1, 541 | "start_at": 0, 542 | "end_at": 1, 543 | "instantid": [ 544 | "35", 545 | 0 546 | ], 547 | "insightface": [ 548 | "36", 549 | 0 550 | ], 551 | "control_net": [ 552 | "40", 553 | 0 554 | ], 555 | "image": [ 556 | "22", 557 | 0 558 | ], 559 | "model": [ 560 | "2", 561 | 0 562 | ], 563 | "positive": [ 564 | "2", 565 | 1 566 | ], 567 | "negative": [ 568 | "2", 569 | 2 570 | ] 571 | }, 572 | "class_type": "ApplyInstantID", 573 | "_meta": { 574 | "title": "Apply InstantID" 575 | } 576 | }, 577 | "42": { 578 | "inputs": { 579 | "ipadapter_file": "ip-adapter-plus-face_sdxl_vit-h.safetensors" 580 | }, 581 | "class_type": "IPAdapterModelLoader", 582 | "_meta": { 583 | "title": "Load IPAdapter Model" 584 | } 585 | }, 586 | "43": { 587 | "inputs": { 588 | "weight": 0.2, 589 | "noise": 0.5, 590 | "weight_type": "original", 591 | "start_at": 0, 592 | "end_at": 0.2, 593 | "faceid_v2": false, 594 | "weight_v2": 0.4, 595 | "unfold_batch": false, 596 | "ipadapter": [ 597 | "42", 598 | 0 599 | ], 600 | "clip_vision": [ 601 | "44", 602 | 0 603 | ], 604 | "insightface": [ 605 | "45", 606 | 0 607 | ], 608 | "image": [ 609 | "22", 610 | 0 611 | ], 612 | "model": [ 613 | "41", 614 | 0 615 | ] 616 | }, 617 | "class_type": "IPAdapterApplyFaceID", 618 | "_meta": { 619 | "title": "Apply IPAdapter FaceID" 620 | } 621 | }, 622 | "44": { 623 | "inputs": { 624 | "clip_name": "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors" 625 | }, 626 | "class_type": "CLIPVisionLoader", 627 | "_meta": { 628 | "title": "Load CLIP Vision" 629 | } 630 | }, 631 | "45": { 632 | "inputs": { 633 | "provider": "CPU" 634 | }, 635 | "class_type": "InsightFaceLoader", 636 | "_meta": { 637 | "title": "Load InsightFace" 638 | } 639 | }, 640 | "47": { 641 | "inputs": { 642 | "images": [ 643 | "25", 644 | 0 645 | ] 646 | }, 647 | "class_type": "PreviewImage", 648 | "_meta": { 649 | "title": "Preview Image" 650 | } 651 | } 652 | } 653 | -------------------------------------------------------------------------------- /face-to-sticker-ui.json: -------------------------------------------------------------------------------- 1 | { 2 | "last_node_id": 47, 3 | "last_link_id": 83, 4 | "nodes": [ 5 | { 6 | "id": 5, 7 | "type": "SaveImage", 8 | "pos": [ 9 | 2382, 10 | 134 11 | ], 12 | "size": { 13 | "0": 315, 14 | "1": 270 15 | }, 16 | "flags": {}, 17 | "order": 25, 18 | "mode": 0, 19 | "inputs": [ 20 | { 21 | "name": "images", 22 | "type": "IMAGE", 23 | "link": 7 24 | } 25 | ], 26 | "properties": {}, 27 | "widgets_values": [ 28 | "ComfyUI" 29 | ] 30 | }, 31 | { 32 | "id": 9, 33 | "type": "BRIA_RMBG_Zho", 34 | "pos": [ 35 | 2475, 36 | 566 37 | ], 38 | "size": { 39 | "0": 210, 40 | "1": 46 41 | }, 42 | "flags": {}, 43 | "order": 26, 44 | "mode": 0, 45 | "inputs": [ 46 | { 47 | "name": "rmbgmodel", 48 | "type": "RMBGMODEL", 49 | "link": 11 50 | }, 51 | { 52 | "name": "image", 53 | "type": "IMAGE", 54 | "link": 10 55 | } 56 | ], 57 | "outputs": [ 58 | { 59 | "name": "image", 60 | "type": "IMAGE", 61 | "links": [ 62 | 12 63 | ], 64 | "shape": 3, 65 | "slot_index": 0 66 | }, 67 | { 68 | "name": "mask", 69 | "type": "MASK", 70 | "links": null, 71 | "shape": 3 72 | } 73 | ], 74 | "properties": { 75 | "Node name for S&R": "BRIA_RMBG_Zho" 76 | } 77 | }, 78 | { 79 | "id": 8, 80 | "type": "BRIA_RMBG_ModelLoader_Zho", 81 | "pos": [ 82 | 2468, 83 | 497 84 | ], 85 | "size": { 86 | "0": 210, 87 | "1": 26 88 | }, 89 | "flags": {}, 90 | "order": 0, 91 | "mode": 0, 92 | "outputs": [ 93 | { 94 | "name": "rmbgmodel", 95 | "type": "RMBGMODEL", 96 | "links": [ 97 | 11, 98 | 22 99 | ], 100 | "shape": 3, 101 | "slot_index": 0 102 | } 103 | ], 104 | "properties": { 105 | "Node name for S&R": "BRIA_RMBG_ModelLoader_Zho" 106 | } 107 | }, 108 | { 109 | "id": 16, 110 | "type": "SaveImage", 111 | "pos": [ 112 | 3546, 113 | 338 114 | ], 115 | "size": { 116 | "0": 315, 117 | "1": 270 118 | }, 119 | "flags": {}, 120 | "order": 18, 121 | "mode": 0, 122 | "inputs": [ 123 | { 124 | "name": "images", 125 | "type": "IMAGE", 126 | "link": 21 127 | } 128 | ], 129 | "properties": {}, 130 | "widgets_values": [ 131 | "ComfyUI" 132 | ] 133 | }, 134 | { 135 | "id": 18, 136 | "type": "SaveImage", 137 | "pos": [ 138 | 3910.3128613281233, 139 | 454.19558898925743 140 | ], 141 | "size": { 142 | "0": 315, 143 | "1": 270 144 | }, 145 | "flags": {}, 146 | "order": 21, 147 | "mode": 0, 148 | "inputs": [ 149 | { 150 | "name": "images", 151 | "type": "IMAGE", 152 | "link": 24 153 | } 154 | ], 155 | "properties": {}, 156 | "widgets_values": [ 157 | "ComfyUI" 158 | ] 159 | }, 160 | { 161 | "id": 17, 162 | "type": "BRIA_RMBG_Zho", 163 | "pos": [ 164 | 3570, 165 | 652 166 | ], 167 | "size": { 168 | "0": 210, 169 | "1": 46 170 | }, 171 | "flags": {}, 172 | "order": 19, 173 | "mode": 0, 174 | "inputs": [ 175 | { 176 | "name": "rmbgmodel", 177 | "type": "RMBGMODEL", 178 | "link": 22 179 | }, 180 | { 181 | "name": "image", 182 | "type": "IMAGE", 183 | "link": 23 184 | } 185 | ], 186 | "outputs": [ 187 | { 188 | "name": "image", 189 | "type": "IMAGE", 190 | "links": [ 191 | 24 192 | ], 193 | "shape": 3, 194 | "slot_index": 0 195 | }, 196 | { 197 | "name": "mask", 198 | "type": "MASK", 199 | "links": null, 200 | "shape": 3 201 | } 202 | ], 203 | "properties": { 204 | "Node name for S&R": "BRIA_RMBG_Zho" 205 | } 206 | }, 207 | { 208 | "id": 15, 209 | "type": "UpscaleModelLoader", 210 | "pos": [ 211 | 3136, 212 | -149 213 | ], 214 | "size": { 215 | "0": 315, 216 | "1": 58 217 | }, 218 | "flags": {}, 219 | "order": 1, 220 | "mode": 0, 221 | "outputs": [ 222 | { 223 | "name": "UPSCALE_MODEL", 224 | "type": "UPSCALE_MODEL", 225 | "links": [ 226 | 20 227 | ], 228 | "shape": 3, 229 | "slot_index": 0 230 | } 231 | ], 232 | "properties": { 233 | "Node name for S&R": "UpscaleModelLoader" 234 | }, 235 | "widgets_values": [ 236 | "4x-AnimeSharp.pth" 237 | ] 238 | }, 239 | { 240 | "id": 10, 241 | "type": "SaveImage", 242 | "pos": [ 243 | 2746, 244 | 169 245 | ], 246 | "size": { 247 | "0": 315, 248 | "1": 270 249 | }, 250 | "flags": {}, 251 | "order": 27, 252 | "mode": 0, 253 | "inputs": [ 254 | { 255 | "name": "images", 256 | "type": "IMAGE", 257 | "link": 12 258 | } 259 | ], 260 | "properties": {}, 261 | "widgets_values": [ 262 | "ComfyUI" 263 | ] 264 | }, 265 | { 266 | "id": 24, 267 | "type": "ControlNetLoader", 268 | "pos": [ 269 | 1234, 270 | 775 271 | ], 272 | "size": { 273 | "0": 315, 274 | "1": 58 275 | }, 276 | "flags": {}, 277 | "order": 2, 278 | "mode": 0, 279 | "outputs": [ 280 | { 281 | "name": "CONTROL_NET", 282 | "type": "CONTROL_NET", 283 | "links": [ 284 | 34 285 | ], 286 | "shape": 3, 287 | "slot_index": 0 288 | } 289 | ], 290 | "properties": { 291 | "Node name for S&R": "ControlNetLoader" 292 | }, 293 | "widgets_values": [ 294 | "depth-zoe-xl-v1.0-controlnet.safetensors" 295 | ] 296 | }, 297 | { 298 | "id": 44, 299 | "type": "CLIPVisionLoader", 300 | "pos": [ 301 | 2057, 302 | -299 303 | ], 304 | "size": { 305 | "0": 315, 306 | "1": 58 307 | }, 308 | "flags": {}, 309 | "order": 3, 310 | "mode": 0, 311 | "outputs": [ 312 | { 313 | "name": "CLIP_VISION", 314 | "type": "CLIP_VISION", 315 | "links": [ 316 | 66 317 | ], 318 | "shape": 3, 319 | "slot_index": 0 320 | } 321 | ], 322 | "properties": { 323 | "Node name for S&R": "CLIPVisionLoader" 324 | }, 325 | "widgets_values": [ 326 | "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors" 327 | ] 328 | }, 329 | { 330 | "id": 12, 331 | "type": "CheckpointLoaderSimple", 332 | "pos": [ 333 | 3135, 334 | -33 335 | ], 336 | "size": { 337 | "0": 315, 338 | "1": 98 339 | }, 340 | "flags": {}, 341 | "order": 4, 342 | "mode": 0, 343 | "outputs": [ 344 | { 345 | "name": "MODEL", 346 | "type": "MODEL", 347 | "links": [ 348 | 77 349 | ], 350 | "shape": 3, 351 | "slot_index": 0 352 | }, 353 | { 354 | "name": "CLIP", 355 | "type": "CLIP", 356 | "links": [ 357 | 15, 358 | 17 359 | ], 360 | "shape": 3, 361 | "slot_index": 1 362 | }, 363 | { 364 | "name": "VAE", 365 | "type": "VAE", 366 | "links": [ 367 | 80 368 | ], 369 | "shape": 3, 370 | "slot_index": 2 371 | } 372 | ], 373 | "properties": { 374 | "Node name for S&R": "CheckpointLoaderSimple" 375 | }, 376 | "widgets_values": [ 377 | "dreamshaper_8.safetensors" 378 | ] 379 | }, 380 | { 381 | "id": 13, 382 | "type": "CLIPTextEncode", 383 | "pos": [ 384 | 3543, 385 | -195 386 | ], 387 | "size": { 388 | "0": 400, 389 | "1": 200 390 | }, 391 | "flags": {}, 392 | "order": 12, 393 | "mode": 0, 394 | "inputs": [ 395 | { 396 | "name": "clip", 397 | "type": "CLIP", 398 | "link": 15 399 | } 400 | ], 401 | "outputs": [ 402 | { 403 | "name": "CONDITIONING", 404 | "type": "CONDITIONING", 405 | "links": [ 406 | 78 407 | ], 408 | "shape": 3, 409 | "slot_index": 0 410 | } 411 | ], 412 | "properties": { 413 | "Node name for S&R": "CLIPTextEncode" 414 | }, 415 | "widgets_values": [ 416 | "svg, vector art, sharp" 417 | ] 418 | }, 419 | { 420 | "id": 14, 421 | "type": "CLIPTextEncode", 422 | "pos": [ 423 | 3526, 424 | 82 425 | ], 426 | "size": { 427 | "0": 400, 428 | "1": 200 429 | }, 430 | "flags": {}, 431 | "order": 13, 432 | "mode": 0, 433 | "inputs": [ 434 | { 435 | "name": "clip", 436 | "type": "CLIP", 437 | "link": 17, 438 | "slot_index": 0 439 | } 440 | ], 441 | "outputs": [ 442 | { 443 | "name": "CONDITIONING", 444 | "type": "CONDITIONING", 445 | "links": [ 446 | 79 447 | ], 448 | "shape": 3, 449 | "slot_index": 0 450 | } 451 | ], 452 | "properties": { 453 | "Node name for S&R": "CLIPTextEncode" 454 | }, 455 | "widgets_values": [ 456 | "nsfw, photo, photography, watermark" 457 | ] 458 | }, 459 | { 460 | "id": 3, 461 | "type": "LoRA Stacker", 462 | "pos": [ 463 | 1114, 464 | 164 465 | ], 466 | "size": { 467 | "0": 315, 468 | "1": 226 469 | }, 470 | "flags": {}, 471 | "order": 5, 472 | "mode": 0, 473 | "inputs": [ 474 | { 475 | "name": "lora_stack", 476 | "type": "LORA_STACK", 477 | "link": null 478 | } 479 | ], 480 | "outputs": [ 481 | { 482 | "name": "LORA_STACK", 483 | "type": "LORA_STACK", 484 | "links": [ 485 | 1 486 | ], 487 | "shape": 3, 488 | "slot_index": 0 489 | } 490 | ], 491 | "properties": { 492 | "Node name for S&R": "LoRA Stacker" 493 | }, 494 | "widgets_values": [ 495 | "simple", 496 | 3, 497 | "artificialguybr/StickersRedmond.safetensors", 498 | 1, 499 | 1, 500 | 1, 501 | "None", 502 | 1, 503 | 1, 504 | 1, 505 | "None", 506 | 1, 507 | 1, 508 | 1, 509 | "None", 510 | 1, 511 | 1, 512 | 1, 513 | "None", 514 | 1, 515 | 1, 516 | 1, 517 | "None", 518 | 1, 519 | 1, 520 | 1, 521 | "None", 522 | 1, 523 | 1, 524 | 1, 525 | "None", 526 | 1, 527 | 1, 528 | 1, 529 | "None", 530 | 1, 531 | 1, 532 | 1, 533 | "None", 534 | 1, 535 | 1, 536 | 1, 537 | "None", 538 | 1, 539 | 1, 540 | 1, 541 | "None", 542 | 1, 543 | 1, 544 | 1, 545 | "None", 546 | 1, 547 | 1, 548 | 1, 549 | "None", 550 | 1, 551 | 1, 552 | 1, 553 | "None", 554 | 1, 555 | 1, 556 | 1, 557 | "None", 558 | 1, 559 | 1, 560 | 1, 561 | "None", 562 | 1, 563 | 1, 564 | 1, 565 | "None", 566 | 1, 567 | 1, 568 | 1, 569 | "None", 570 | 1, 571 | 1, 572 | 1, 573 | "None", 574 | 1, 575 | 1, 576 | 1, 577 | "None", 578 | 1, 579 | 1, 580 | 1, 581 | "None", 582 | 1, 583 | 1, 584 | 1, 585 | "None", 586 | 1, 587 | 1, 588 | 1, 589 | "None", 590 | 1, 591 | 1, 592 | 1, 593 | "None", 594 | 1, 595 | 1, 596 | 1, 597 | "None", 598 | 1, 599 | 1, 600 | 1, 601 | "None", 602 | 1, 603 | 1, 604 | 1, 605 | "None", 606 | 1, 607 | 1, 608 | 1, 609 | "None", 610 | 1, 611 | 1, 612 | 1, 613 | "None", 614 | 1, 615 | 1, 616 | 1, 617 | "None", 618 | 1, 619 | 1, 620 | 1, 621 | "None", 622 | 1, 623 | 1, 624 | 1, 625 | "None", 626 | 1, 627 | 1, 628 | 1, 629 | "None", 630 | 1, 631 | 1, 632 | 1, 633 | "None", 634 | 1, 635 | 1, 636 | 1, 637 | "None", 638 | 1, 639 | 1, 640 | 1, 641 | "None", 642 | 1, 643 | 1, 644 | 1, 645 | "None", 646 | 1, 647 | 1, 648 | 1, 649 | "None", 650 | 1, 651 | 1, 652 | 1, 653 | "None", 654 | 1, 655 | 1, 656 | 1, 657 | "None", 658 | 1, 659 | 1, 660 | 1, 661 | "None", 662 | 1, 663 | 1, 664 | 1, 665 | "None", 666 | 1, 667 | 1, 668 | 1, 669 | "None", 670 | 1, 671 | 1, 672 | 1, 673 | "None", 674 | 1, 675 | 1, 676 | 1, 677 | "None", 678 | 1, 679 | 1, 680 | 1, 681 | "None", 682 | 1, 683 | 1, 684 | 1, 685 | "None", 686 | 1, 687 | 1, 688 | 1, 689 | "None", 690 | 1, 691 | 1, 692 | 1 693 | ], 694 | "color": "#222233", 695 | "bgcolor": "#333355", 696 | "shape": 1 697 | }, 698 | { 699 | "id": 28, 700 | "type": "Control Net Stacker", 701 | "pos": [ 702 | 1591, 703 | 789 704 | ], 705 | "size": { 706 | "0": 315, 707 | "1": 146 708 | }, 709 | "flags": {}, 710 | "order": 16, 711 | "mode": 0, 712 | "inputs": [ 713 | { 714 | "name": "control_net", 715 | "type": "CONTROL_NET", 716 | "link": 34 717 | }, 718 | { 719 | "name": "image", 720 | "type": "IMAGE", 721 | "link": 35 722 | }, 723 | { 724 | "name": "cnet_stack", 725 | "type": "CONTROL_NET_STACK", 726 | "link": null 727 | } 728 | ], 729 | "outputs": [ 730 | { 731 | "name": "CNET_STACK", 732 | "type": "CONTROL_NET_STACK", 733 | "links": [ 734 | 81 735 | ], 736 | "shape": 3, 737 | "slot_index": 0 738 | } 739 | ], 740 | "properties": { 741 | "Node name for S&R": "Control Net Stacker" 742 | }, 743 | "widgets_values": [ 744 | 0.2, 745 | 0, 746 | 0.7000000000000001 747 | ], 748 | "color": "#223322", 749 | "bgcolor": "#335533", 750 | "shape": 1 751 | }, 752 | { 753 | "id": 47, 754 | "type": "PreviewImage", 755 | "pos": [ 756 | 1600, 757 | 1009 758 | ], 759 | "size": [ 760 | 210, 761 | 246 762 | ], 763 | "flags": {}, 764 | "order": 17, 765 | "mode": 0, 766 | "inputs": [ 767 | { 768 | "name": "images", 769 | "type": "IMAGE", 770 | "link": 83 771 | } 772 | ], 773 | "properties": { 774 | "Node name for S&R": "PreviewImage" 775 | } 776 | }, 777 | { 778 | "id": 25, 779 | "type": "AIO_Preprocessor", 780 | "pos": [ 781 | 1241, 782 | 893 783 | ], 784 | "size": { 785 | "0": 315, 786 | "1": 82 787 | }, 788 | "flags": {}, 789 | "order": 14, 790 | "mode": 0, 791 | "inputs": [ 792 | { 793 | "name": "image", 794 | "type": "IMAGE", 795 | "link": 31 796 | } 797 | ], 798 | "outputs": [ 799 | { 800 | "name": "IMAGE", 801 | "type": "IMAGE", 802 | "links": [ 803 | 35, 804 | 83 805 | ], 806 | "shape": 3, 807 | "slot_index": 0 808 | } 809 | ], 810 | "properties": { 811 | "Node name for S&R": "AIO_Preprocessor" 812 | }, 813 | "widgets_values": [ 814 | "Zoe-DepthMapPreprocessor", 815 | 1024 816 | ] 817 | }, 818 | { 819 | "id": 40, 820 | "type": "ControlNetLoader", 821 | "pos": [ 822 | 2628, 823 | -887 824 | ], 825 | "size": { 826 | "0": 315, 827 | "1": 58 828 | }, 829 | "flags": {}, 830 | "order": 6, 831 | "mode": 0, 832 | "outputs": [ 833 | { 834 | "name": "CONTROL_NET", 835 | "type": "CONTROL_NET", 836 | "links": [ 837 | 48 838 | ], 839 | "shape": 3, 840 | "slot_index": 0 841 | } 842 | ], 843 | "properties": { 844 | "Node name for S&R": "ControlNetLoader" 845 | }, 846 | "widgets_values": [ 847 | "instantid-controlnet.safetensors" 848 | ] 849 | }, 850 | { 851 | "id": 35, 852 | "type": "InstantIDModelLoader", 853 | "pos": [ 854 | 2628, 855 | -779 856 | ], 857 | "size": { 858 | "0": 315, 859 | "1": 58 860 | }, 861 | "flags": {}, 862 | "order": 7, 863 | "mode": 0, 864 | "outputs": [ 865 | { 866 | "name": "INSTANTID", 867 | "type": "INSTANTID", 868 | "links": [ 869 | 49 870 | ], 871 | "shape": 3, 872 | "slot_index": 0 873 | } 874 | ], 875 | "properties": { 876 | "Node name for S&R": "InstantIDModelLoader" 877 | }, 878 | "widgets_values": [ 879 | "instantid-ip-adapter.bin" 880 | ] 881 | }, 882 | { 883 | "id": 36, 884 | "type": "InstantIDFaceAnalysis", 885 | "pos": [ 886 | 2612, 887 | -664 888 | ], 889 | "size": { 890 | "0": 315, 891 | "1": 58 892 | }, 893 | "flags": {}, 894 | "order": 8, 895 | "mode": 0, 896 | "outputs": [ 897 | { 898 | "name": "FACEANALYSIS", 899 | "type": "FACEANALYSIS", 900 | "links": [ 901 | 50 902 | ], 903 | "shape": 3, 904 | "slot_index": 0 905 | } 906 | ], 907 | "properties": { 908 | "Node name for S&R": "InstantIDFaceAnalysis" 909 | }, 910 | "widgets_values": [ 911 | "CPU" 912 | ] 913 | }, 914 | { 915 | "id": 41, 916 | "type": "ApplyInstantID", 917 | "pos": [ 918 | 3046, 919 | -849 920 | ], 921 | "size": { 922 | "0": 315, 923 | "1": 266 924 | }, 925 | "flags": {}, 926 | "order": 22, 927 | "mode": 0, 928 | "inputs": [ 929 | { 930 | "name": "instantid", 931 | "type": "INSTANTID", 932 | "link": 49 933 | }, 934 | { 935 | "name": "insightface", 936 | "type": "FACEANALYSIS", 937 | "link": 50 938 | }, 939 | { 940 | "name": "control_net", 941 | "type": "CONTROL_NET", 942 | "link": 48 943 | }, 944 | { 945 | "name": "image", 946 | "type": "IMAGE", 947 | "link": 52 948 | }, 949 | { 950 | "name": "model", 951 | "type": "MODEL", 952 | "link": 60 953 | }, 954 | { 955 | "name": "positive", 956 | "type": "CONDITIONING", 957 | "link": 56 958 | }, 959 | { 960 | "name": "negative", 961 | "type": "CONDITIONING", 962 | "link": 55 963 | }, 964 | { 965 | "name": "image_kps", 966 | "type": "IMAGE", 967 | "link": null 968 | }, 969 | { 970 | "name": "mask", 971 | "type": "MASK", 972 | "link": null 973 | } 974 | ], 975 | "outputs": [ 976 | { 977 | "name": "MODEL", 978 | "type": "MODEL", 979 | "links": [ 980 | 69 981 | ], 982 | "shape": 3, 983 | "slot_index": 0 984 | }, 985 | { 986 | "name": "POSITIVE", 987 | "type": "CONDITIONING", 988 | "links": [ 989 | 58 990 | ], 991 | "shape": 3, 992 | "slot_index": 1 993 | }, 994 | { 995 | "name": "NEGATIVE", 996 | "type": "CONDITIONING", 997 | "links": [ 998 | 57 999 | ], 1000 | "shape": 3, 1001 | "slot_index": 2 1002 | } 1003 | ], 1004 | "properties": { 1005 | "Node name for S&R": "ApplyInstantID" 1006 | }, 1007 | "widgets_values": [ 1008 | 1, 1009 | 0, 1010 | 1 1011 | ] 1012 | }, 1013 | { 1014 | "id": 45, 1015 | "type": "InsightFaceLoader", 1016 | "pos": [ 1017 | 2083, 1018 | -529 1019 | ], 1020 | "size": { 1021 | "0": 315, 1022 | "1": 58 1023 | }, 1024 | "flags": {}, 1025 | "order": 9, 1026 | "mode": 0, 1027 | "outputs": [ 1028 | { 1029 | "name": "INSIGHTFACE", 1030 | "type": "INSIGHTFACE", 1031 | "links": [ 1032 | 67 1033 | ], 1034 | "shape": 3, 1035 | "slot_index": 0 1036 | } 1037 | ], 1038 | "properties": { 1039 | "Node name for S&R": "InsightFaceLoader" 1040 | }, 1041 | "widgets_values": [ 1042 | "CPU" 1043 | ] 1044 | }, 1045 | { 1046 | "id": 42, 1047 | "type": "IPAdapterModelLoader", 1048 | "pos": [ 1049 | 2113, 1050 | -423 1051 | ], 1052 | "size": { 1053 | "0": 315, 1054 | "1": 58 1055 | }, 1056 | "flags": {}, 1057 | "order": 10, 1058 | "mode": 0, 1059 | "outputs": [ 1060 | { 1061 | "name": "IPADAPTER", 1062 | "type": "IPADAPTER", 1063 | "links": [ 1064 | 65 1065 | ], 1066 | "shape": 3, 1067 | "slot_index": 0 1068 | } 1069 | ], 1070 | "properties": { 1071 | "Node name for S&R": "IPAdapterModelLoader" 1072 | }, 1073 | "widgets_values": [ 1074 | "ip-adapter-plus-face_sdxl_vit-h.safetensors" 1075 | ] 1076 | }, 1077 | { 1078 | "id": 43, 1079 | "type": "IPAdapterApplyFaceID", 1080 | "pos": [ 1081 | 2677, 1082 | -312 1083 | ], 1084 | "size": { 1085 | "0": 315, 1086 | "1": 326 1087 | }, 1088 | "flags": {}, 1089 | "order": 23, 1090 | "mode": 0, 1091 | "inputs": [ 1092 | { 1093 | "name": "ipadapter", 1094 | "type": "IPADAPTER", 1095 | "link": 65 1096 | }, 1097 | { 1098 | "name": "clip_vision", 1099 | "type": "CLIP_VISION", 1100 | "link": 66 1101 | }, 1102 | { 1103 | "name": "insightface", 1104 | "type": "INSIGHTFACE", 1105 | "link": 67 1106 | }, 1107 | { 1108 | "name": "image", 1109 | "type": "IMAGE", 1110 | "link": 68 1111 | }, 1112 | { 1113 | "name": "model", 1114 | "type": "MODEL", 1115 | "link": 69 1116 | }, 1117 | { 1118 | "name": "attn_mask", 1119 | "type": "MASK", 1120 | "link": null 1121 | } 1122 | ], 1123 | "outputs": [ 1124 | { 1125 | "name": "MODEL", 1126 | "type": "MODEL", 1127 | "links": [ 1128 | 70 1129 | ], 1130 | "shape": 3, 1131 | "slot_index": 0 1132 | } 1133 | ], 1134 | "properties": { 1135 | "Node name for S&R": "IPAdapterApplyFaceID" 1136 | }, 1137 | "widgets_values": [ 1138 | 0.2, 1139 | 0.5, 1140 | "original", 1141 | 0, 1142 | 0.2, 1143 | false, 1144 | 0.4, 1145 | false 1146 | ] 1147 | }, 1148 | { 1149 | "id": 11, 1150 | "type": "UltimateSDUpscale", 1151 | "pos": [ 1152 | 3133, 1153 | 167 1154 | ], 1155 | "size": { 1156 | "0": 315, 1157 | "1": 614 1158 | }, 1159 | "flags": {}, 1160 | "order": 15, 1161 | "mode": 0, 1162 | "inputs": [ 1163 | { 1164 | "name": "image", 1165 | "type": "IMAGE", 1166 | "link": null 1167 | }, 1168 | { 1169 | "name": "model", 1170 | "type": "MODEL", 1171 | "link": 77, 1172 | "slot_index": 1 1173 | }, 1174 | { 1175 | "name": "positive", 1176 | "type": "CONDITIONING", 1177 | "link": 78 1178 | }, 1179 | { 1180 | "name": "negative", 1181 | "type": "CONDITIONING", 1182 | "link": 79 1183 | }, 1184 | { 1185 | "name": "vae", 1186 | "type": "VAE", 1187 | "link": 80 1188 | }, 1189 | { 1190 | "name": "upscale_model", 1191 | "type": "UPSCALE_MODEL", 1192 | "link": 20 1193 | } 1194 | ], 1195 | "outputs": [ 1196 | { 1197 | "name": "IMAGE", 1198 | "type": "IMAGE", 1199 | "links": [ 1200 | 21, 1201 | 23 1202 | ], 1203 | "shape": 3, 1204 | "slot_index": 0 1205 | } 1206 | ], 1207 | "properties": { 1208 | "Node name for S&R": "UltimateSDUpscale" 1209 | }, 1210 | "widgets_values": [ 1211 | 2, 1212 | 786855515709664, 1213 | "randomize", 1214 | 10, 1215 | 8, 1216 | "euler", 1217 | "normal", 1218 | 0.2, 1219 | "Linear", 1220 | 512, 1221 | 512, 1222 | 8, 1223 | 32, 1224 | "None", 1225 | 1, 1226 | 64, 1227 | 8, 1228 | 16, 1229 | true, 1230 | false 1231 | ] 1232 | }, 1233 | { 1234 | "id": 4, 1235 | "type": "KSampler (Efficient)", 1236 | "pos": [ 1237 | 2047, 1238 | 323 1239 | ], 1240 | "size": { 1241 | "0": 325, 1242 | "1": 562 1243 | }, 1244 | "flags": {}, 1245 | "order": 24, 1246 | "mode": 0, 1247 | "inputs": [ 1248 | { 1249 | "name": "model", 1250 | "type": "MODEL", 1251 | "link": 70 1252 | }, 1253 | { 1254 | "name": "positive", 1255 | "type": "CONDITIONING", 1256 | "link": 58 1257 | }, 1258 | { 1259 | "name": "negative", 1260 | "type": "CONDITIONING", 1261 | "link": 57 1262 | }, 1263 | { 1264 | "name": "latent_image", 1265 | "type": "LATENT", 1266 | "link": 5 1267 | }, 1268 | { 1269 | "name": "optional_vae", 1270 | "type": "VAE", 1271 | "link": 6 1272 | }, 1273 | { 1274 | "name": "script", 1275 | "type": "SCRIPT", 1276 | "link": null 1277 | } 1278 | ], 1279 | "outputs": [ 1280 | { 1281 | "name": "MODEL", 1282 | "type": "MODEL", 1283 | "links": [], 1284 | "shape": 3, 1285 | "slot_index": 0 1286 | }, 1287 | { 1288 | "name": "CONDITIONING+", 1289 | "type": "CONDITIONING", 1290 | "links": [], 1291 | "shape": 3, 1292 | "slot_index": 1 1293 | }, 1294 | { 1295 | "name": "CONDITIONING-", 1296 | "type": "CONDITIONING", 1297 | "links": [], 1298 | "shape": 3, 1299 | "slot_index": 2 1300 | }, 1301 | { 1302 | "name": "LATENT", 1303 | "type": "LATENT", 1304 | "links": null, 1305 | "shape": 3 1306 | }, 1307 | { 1308 | "name": "VAE", 1309 | "type": "VAE", 1310 | "links": [], 1311 | "shape": 3, 1312 | "slot_index": 4 1313 | }, 1314 | { 1315 | "name": "IMAGE", 1316 | "type": "IMAGE", 1317 | "links": [ 1318 | 7, 1319 | 10 1320 | ], 1321 | "shape": 3, 1322 | "slot_index": 5 1323 | } 1324 | ], 1325 | "properties": { 1326 | "Node name for S&R": "KSampler (Efficient)" 1327 | }, 1328 | "widgets_values": [ 1329 | 32966725480658, 1330 | null, 1331 | 20, 1332 | 7, 1333 | "dpmpp_2m_sde", 1334 | "karras", 1335 | 1, 1336 | "none", 1337 | "true" 1338 | ], 1339 | "color": "#223333", 1340 | "bgcolor": "#335555", 1341 | "shape": 1 1342 | }, 1343 | { 1344 | "id": 2, 1345 | "type": "Efficient Loader", 1346 | "pos": [ 1347 | 1560, 1348 | 150 1349 | ], 1350 | "size": { 1351 | "0": 400, 1352 | "1": 462 1353 | }, 1354 | "flags": {}, 1355 | "order": 20, 1356 | "mode": 0, 1357 | "inputs": [ 1358 | { 1359 | "name": "lora_stack", 1360 | "type": "LORA_STACK", 1361 | "link": 1 1362 | }, 1363 | { 1364 | "name": "cnet_stack", 1365 | "type": "CONTROL_NET_STACK", 1366 | "link": 81 1367 | } 1368 | ], 1369 | "outputs": [ 1370 | { 1371 | "name": "MODEL", 1372 | "type": "MODEL", 1373 | "links": [ 1374 | 60 1375 | ], 1376 | "shape": 3, 1377 | "slot_index": 0 1378 | }, 1379 | { 1380 | "name": "CONDITIONING+", 1381 | "type": "CONDITIONING", 1382 | "links": [ 1383 | 56 1384 | ], 1385 | "shape": 3, 1386 | "slot_index": 1 1387 | }, 1388 | { 1389 | "name": "CONDITIONING-", 1390 | "type": "CONDITIONING", 1391 | "links": [ 1392 | 55 1393 | ], 1394 | "shape": 3, 1395 | "slot_index": 2 1396 | }, 1397 | { 1398 | "name": "LATENT", 1399 | "type": "LATENT", 1400 | "links": [ 1401 | 5 1402 | ], 1403 | "shape": 3, 1404 | "slot_index": 3 1405 | }, 1406 | { 1407 | "name": "VAE", 1408 | "type": "VAE", 1409 | "links": [ 1410 | 6 1411 | ], 1412 | "shape": 3, 1413 | "slot_index": 4 1414 | }, 1415 | { 1416 | "name": "CLIP", 1417 | "type": "CLIP", 1418 | "links": null, 1419 | "shape": 3 1420 | }, 1421 | { 1422 | "name": "DEPENDENCIES", 1423 | "type": "DEPENDENCIES", 1424 | "links": null, 1425 | "shape": 3 1426 | } 1427 | ], 1428 | "properties": { 1429 | "Node name for S&R": "Efficient Loader" 1430 | }, 1431 | "widgets_values": [ 1432 | "albedobaseXL_v13.safetensors", 1433 | "Baked VAE", 1434 | -1, 1435 | "None", 1436 | 1, 1437 | 1, 1438 | "Sticker, scary zombie, cel shaded, svg, vector art, sharp", 1439 | "open mouth, shiny, photo, photography, soft, nsfw, nude, ugly, broken, watermark, oversaturated", 1440 | "none", 1441 | "comfy", 1442 | 1024, 1443 | 1024, 1444 | 1 1445 | ], 1446 | "color": "#222233", 1447 | "bgcolor": "#333355", 1448 | "shape": 1 1449 | }, 1450 | { 1451 | "id": 22, 1452 | "type": "LoadImage", 1453 | "pos": [ 1454 | 1535, 1455 | -472 1456 | ], 1457 | "size": { 1458 | "0": 315, 1459 | "1": 314 1460 | }, 1461 | "flags": {}, 1462 | "order": 11, 1463 | "mode": 0, 1464 | "outputs": [ 1465 | { 1466 | "name": "IMAGE", 1467 | "type": "IMAGE", 1468 | "links": [ 1469 | 31, 1470 | 52, 1471 | 68 1472 | ], 1473 | "shape": 3, 1474 | "slot_index": 0 1475 | }, 1476 | { 1477 | "name": "MASK", 1478 | "type": "MASK", 1479 | "links": null, 1480 | "shape": 3 1481 | } 1482 | ], 1483 | "properties": { 1484 | "Node name for S&R": "LoadImage" 1485 | }, 1486 | "widgets_values": [ 1487 | "0_1.webp", 1488 | "image" 1489 | ] 1490 | } 1491 | ], 1492 | "links": [ 1493 | [ 1494 | 1, 1495 | 3, 1496 | 0, 1497 | 2, 1498 | 0, 1499 | "LORA_STACK" 1500 | ], 1501 | [ 1502 | 5, 1503 | 2, 1504 | 3, 1505 | 4, 1506 | 3, 1507 | "LATENT" 1508 | ], 1509 | [ 1510 | 6, 1511 | 2, 1512 | 4, 1513 | 4, 1514 | 4, 1515 | "VAE" 1516 | ], 1517 | [ 1518 | 7, 1519 | 4, 1520 | 5, 1521 | 5, 1522 | 0, 1523 | "IMAGE" 1524 | ], 1525 | [ 1526 | 10, 1527 | 4, 1528 | 5, 1529 | 9, 1530 | 1, 1531 | "IMAGE" 1532 | ], 1533 | [ 1534 | 11, 1535 | 8, 1536 | 0, 1537 | 9, 1538 | 0, 1539 | "RMBGMODEL" 1540 | ], 1541 | [ 1542 | 12, 1543 | 9, 1544 | 0, 1545 | 10, 1546 | 0, 1547 | "IMAGE" 1548 | ], 1549 | [ 1550 | 15, 1551 | 12, 1552 | 1, 1553 | 13, 1554 | 0, 1555 | "CLIP" 1556 | ], 1557 | [ 1558 | 17, 1559 | 12, 1560 | 1, 1561 | 14, 1562 | 0, 1563 | "CLIP" 1564 | ], 1565 | [ 1566 | 20, 1567 | 15, 1568 | 0, 1569 | 11, 1570 | 5, 1571 | "UPSCALE_MODEL" 1572 | ], 1573 | [ 1574 | 21, 1575 | 11, 1576 | 0, 1577 | 16, 1578 | 0, 1579 | "IMAGE" 1580 | ], 1581 | [ 1582 | 22, 1583 | 8, 1584 | 0, 1585 | 17, 1586 | 0, 1587 | "RMBGMODEL" 1588 | ], 1589 | [ 1590 | 23, 1591 | 11, 1592 | 0, 1593 | 17, 1594 | 1, 1595 | "IMAGE" 1596 | ], 1597 | [ 1598 | 24, 1599 | 17, 1600 | 0, 1601 | 18, 1602 | 0, 1603 | "IMAGE" 1604 | ], 1605 | [ 1606 | 31, 1607 | 22, 1608 | 0, 1609 | 25, 1610 | 0, 1611 | "IMAGE" 1612 | ], 1613 | [ 1614 | 34, 1615 | 24, 1616 | 0, 1617 | 28, 1618 | 0, 1619 | "CONTROL_NET" 1620 | ], 1621 | [ 1622 | 35, 1623 | 25, 1624 | 0, 1625 | 28, 1626 | 1, 1627 | "IMAGE" 1628 | ], 1629 | [ 1630 | 48, 1631 | 40, 1632 | 0, 1633 | 41, 1634 | 2, 1635 | "CONTROL_NET" 1636 | ], 1637 | [ 1638 | 49, 1639 | 35, 1640 | 0, 1641 | 41, 1642 | 0, 1643 | "INSTANTID" 1644 | ], 1645 | [ 1646 | 50, 1647 | 36, 1648 | 0, 1649 | 41, 1650 | 1, 1651 | "FACEANALYSIS" 1652 | ], 1653 | [ 1654 | 52, 1655 | 22, 1656 | 0, 1657 | 41, 1658 | 3, 1659 | "IMAGE" 1660 | ], 1661 | [ 1662 | 55, 1663 | 2, 1664 | 2, 1665 | 41, 1666 | 6, 1667 | "CONDITIONING" 1668 | ], 1669 | [ 1670 | 56, 1671 | 2, 1672 | 1, 1673 | 41, 1674 | 5, 1675 | "CONDITIONING" 1676 | ], 1677 | [ 1678 | 57, 1679 | 41, 1680 | 2, 1681 | 4, 1682 | 2, 1683 | "CONDITIONING" 1684 | ], 1685 | [ 1686 | 58, 1687 | 41, 1688 | 1, 1689 | 4, 1690 | 1, 1691 | "CONDITIONING" 1692 | ], 1693 | [ 1694 | 60, 1695 | 2, 1696 | 0, 1697 | 41, 1698 | 4, 1699 | "MODEL" 1700 | ], 1701 | [ 1702 | 65, 1703 | 42, 1704 | 0, 1705 | 43, 1706 | 0, 1707 | "IPADAPTER" 1708 | ], 1709 | [ 1710 | 66, 1711 | 44, 1712 | 0, 1713 | 43, 1714 | 1, 1715 | "CLIP_VISION" 1716 | ], 1717 | [ 1718 | 67, 1719 | 45, 1720 | 0, 1721 | 43, 1722 | 2, 1723 | "INSIGHTFACE" 1724 | ], 1725 | [ 1726 | 68, 1727 | 22, 1728 | 0, 1729 | 43, 1730 | 3, 1731 | "IMAGE" 1732 | ], 1733 | [ 1734 | 69, 1735 | 41, 1736 | 0, 1737 | 43, 1738 | 4, 1739 | "MODEL" 1740 | ], 1741 | [ 1742 | 70, 1743 | 43, 1744 | 0, 1745 | 4, 1746 | 0, 1747 | "MODEL" 1748 | ], 1749 | [ 1750 | 77, 1751 | 12, 1752 | 0, 1753 | 11, 1754 | 1, 1755 | "MODEL" 1756 | ], 1757 | [ 1758 | 78, 1759 | 13, 1760 | 0, 1761 | 11, 1762 | 2, 1763 | "CONDITIONING" 1764 | ], 1765 | [ 1766 | 79, 1767 | 14, 1768 | 0, 1769 | 11, 1770 | 3, 1771 | "CONDITIONING" 1772 | ], 1773 | [ 1774 | 80, 1775 | 12, 1776 | 2, 1777 | 11, 1778 | 4, 1779 | "VAE" 1780 | ], 1781 | [ 1782 | 81, 1783 | 28, 1784 | 0, 1785 | 2, 1786 | 1, 1787 | "CONTROL_NET_STACK" 1788 | ], 1789 | [ 1790 | 83, 1791 | 25, 1792 | 0, 1793 | 47, 1794 | 0, 1795 | "IMAGE" 1796 | ] 1797 | ], 1798 | "groups": [], 1799 | "config": {}, 1800 | "extra": {}, 1801 | "version": 0.4 1802 | } -------------------------------------------------------------------------------- /helpers/ComfyUI_BRIA_AI_RMBG.py: -------------------------------------------------------------------------------- 1 | MODELS = [ 2 | "RMBG-1.4/model.pth", 3 | ] 4 | 5 | class ComfyUI_BRIA_AI_RMBG: 6 | @staticmethod 7 | def models(): 8 | return MODELS 9 | 10 | @staticmethod 11 | def add_weights(weights_to_download, node): 12 | if "class_type" in node and node["class_type"] in [ 13 | "BRIA_RMBG_ModelLoader_Zho", 14 | ]: 15 | weights_to_download.extend(MODELS) 16 | 17 | @staticmethod 18 | def weights_map(base_url): 19 | return { 20 | model: { 21 | "url": f"{base_url}/custom_nodes/ComfyUI-BRIA_AI-RMBG/{model}.tar", 22 | "dest": "ComfyUI/custom_nodes/ComfyUI-BRIA_AI-RMBG/", 23 | } 24 | for model in MODELS 25 | } 26 | -------------------------------------------------------------------------------- /helpers/ComfyUI_Controlnet_Aux.py: -------------------------------------------------------------------------------- 1 | MODELS = { 2 | "UNet.pth": "bdsqlsz/qinglong_controlnet-lllite/Annotators", 3 | "mobile_sam.pt": "dhkim2810/MobileSAM", 4 | "hrnetv2_w64_imagenet_pretrained.pth": "hr16/ControlNet-HandRefiner-pruned", 5 | "graphormer_hand_state_dict.bin": "hr16/ControlNet-HandRefiner-pruned", 6 | "rtmpose-m_ap10k_256_bs5.torchscript.pt": "hr16/DWPose-TorchScript-BatchSize5", 7 | "dw-ll_ucoco_384_bs5.torchscript.pt": "hr16/DWPose-TorchScript-BatchSize5", 8 | "rtmpose-m_ap10k_256.onnx": "hr16/UnJIT-DWPose", 9 | "yolo_nas_s_fp16.onnx": "hr16/yolo-nas-fp16", 10 | "yolo_nas_m_fp16.onnx": "hr16/yolo-nas-fp16", 11 | "yolox_l.torchscript.pt": "hr16/yolox-onnx", 12 | "densepose_r101_fpn_dl.torchscript": "LayerNorm/DensePose-TorchScript-with-hint-image", 13 | "densepose_r50_fpn_dl.torchscript": "LayerNorm/DensePose-TorchScript-with-hint-image", 14 | "mlsd_large_512_fp32.pth": "lllyasviel/Annotators", 15 | "150_16_swin_l_oneformer_coco_100ep.pth": "lllyasviel/Annotators", 16 | "ControlNetHED.pth": "lllyasviel/Annotators", 17 | "ZoeD_M12_N.pt": "lllyasviel/Annotators", 18 | "scannet.pt": "lllyasviel/Annotators", 19 | "hand_pose_model.pth": "lllyasviel/Annotators", 20 | "upernet_global_small.pth": "lllyasviel/Annotators", 21 | "latest_net_G.pth": "lllyasviel/Annotators", 22 | "netG.pth": "lllyasviel/Annotators", 23 | "sk_model2.pth": "lllyasviel/Annotators", 24 | "dpt_hybrid-midas-501f0c75.pt": "lllyasviel/Annotators", 25 | "table5_pidinet.pth": "lllyasviel/Annotators", 26 | "erika.pth": "lllyasviel/Annotators", 27 | "250_16_swin_l_oneformer_ade20k_160k.pth": "lllyasviel/Annotators", 28 | "sk_model.pth": "lllyasviel/Annotators", 29 | "body_pose_model.pth": "lllyasviel/Annotators", 30 | "res101.pth": "lllyasviel/Annotators", 31 | "facenet.pth": "lllyasviel/Annotators", 32 | "isnetis.ckpt": "skytnt/anime-seg", 33 | "yolox_l.onnx": "yzd-v/DWPose", 34 | "dw-ll_ucoco_384.onnx": "yzd-v/DWPose", 35 | } 36 | 37 | 38 | class ComfyUI_Controlnet_Aux: 39 | @staticmethod 40 | def models(): 41 | return MODELS 42 | 43 | @staticmethod 44 | def weights_map(base_url): 45 | return { 46 | key: { 47 | "url": f"{base_url}/custom_nodes/comfyui_controlnet_aux/{key}.tar", 48 | "dest": f"ComfyUI/custom_nodes/comfyui_controlnet_aux/ckpts/{MODELS[key]}", 49 | } 50 | for key in MODELS 51 | } 52 | 53 | # Controlnet preprocessor models are not included in the API JSON 54 | # We need to add them manually based on the nodes being used to 55 | # avoid them being downloaded automatically from elsewhere 56 | @staticmethod 57 | def node_class_mapping(): 58 | return { 59 | # Depth 60 | "MiDaS-NormalMapPreprocessor": "dpt_hybrid-midas-501f0c75.pt", 61 | "MiDaS-DepthMapPreprocessor": "dpt_hybrid-midas-501f0c75.pt", 62 | "Zoe-DepthMapPreprocessor": "ZoeD_M12_N.pt", 63 | "LeReS-DepthMapPreprocessor": ["res101.pth", "latest_net_G.pth"], 64 | "MeshGraphormer-DepthMapPreprocessor": [ 65 | "hrnetv2_w64_imagenet_pretrained.pth", 66 | "graphormer_hand_state_dict.bin", 67 | ], 68 | # Segmentation 69 | "BAE-NormalMapPreprocessor": "scannet.pt", 70 | "OneFormer-COCO-SemSegPreprocessor": "150_16_swin_l_oneformer_coco_100ep.pth", 71 | "OneFormer-ADE20K-SemSegPreprocessor": "250_16_swin_l_oneformer_ade20k_160k.pth", 72 | "UniFormer-SemSegPreprocessor": "upernet_global_small.pth", 73 | "SemSegPreprocessor": "upernet_global_small.pth", 74 | "AnimeFace_SemSegPreprocessor": ["UNet.pth", "isnetis.ckpt"], 75 | "SAMPreprocessor": "mobile_sam.pt", 76 | # Line extractors 77 | "AnimeLineArtPreprocessor": "netG.pth", 78 | "HEDPreprocessor": "ControlNetHED.pth", 79 | "FakeScribblePreprocessor": "ControlNetHED.pth", 80 | "M-LSDPreprocessor": "mlsd_large_512_fp32.pth", 81 | "PiDiNetPreprocessor": "table5_pidinet.pth", 82 | "LineArtPreprocessor": ["sk_model.pth", "sk_model2.pth"], 83 | "Manga2Anime_LineArt_Preprocessor": "erika.pth", 84 | # Pose 85 | "OpenposePreprocessor": [ 86 | "body_pose_model.pth", 87 | "hand_pose_model.pth", 88 | "facenet.pth", 89 | ], 90 | } 91 | 92 | @staticmethod 93 | def add_weights(weights_to_download, node): 94 | node_class = node.get("class_type") 95 | node_mapping = ComfyUI_Controlnet_Aux.node_class_mapping() 96 | 97 | if node_class and node_class in node_mapping: 98 | class_weights = node_mapping[node_class] 99 | if isinstance(class_weights, list): 100 | weights_to_download.extend(class_weights) 101 | else: 102 | weights_to_download.append(class_weights) 103 | 104 | # Additional check for AIO_Preprocessor and its preprocessor input value 105 | if node_class == "AIO_Preprocessor" and "preprocessor" in node.get("inputs", {}): 106 | preprocessor = node["inputs"]["preprocessor"] 107 | if preprocessor in node_mapping: 108 | preprocessor_weights = node_mapping[preprocessor] 109 | if isinstance(preprocessor_weights, list): 110 | weights_to_download.extend(preprocessor_weights) 111 | else: 112 | weights_to_download.append(preprocessor_weights) 113 | -------------------------------------------------------------------------------- /helpers/ComfyUI_IPAdapter_plus.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | 4 | class ComfyUI_IPAdapter_plus: 5 | @staticmethod 6 | def prepare(): 7 | # create the ipadapter folder in ComfyUI/models/ipadapter 8 | # if it doesn't exist at setup time then the plugin defers to the base directory 9 | # and won't look for our ipadaters that are downloaded on demand 10 | if not os.path.exists("ComfyUI/models/ipadapter"): 11 | os.makedirs("ComfyUI/models/ipadapter") 12 | 13 | @staticmethod 14 | def add_weights(weights_to_download, node): 15 | if "class_type" in node and node["class_type"] in [ 16 | "InsightFaceLoader", 17 | ]: 18 | weights_to_download.append("buffalo_l") 19 | -------------------------------------------------------------------------------- /helpers/ComfyUI_InstantID.py: -------------------------------------------------------------------------------- 1 | class ComfyUI_InstantID: 2 | @staticmethod 3 | def add_weights(weights_to_download, node): 4 | if "class_type" in node: 5 | if node["class_type"] == "InstantIDFaceAnalysis": 6 | weights_to_download.append("antelopev2") 7 | elif node["class_type"] == "InstantIDModelLoader": 8 | if "inputs" in node and "instantid_file" in node["inputs"]: 9 | if node["inputs"]["instantid_file"] == "ipadapter.bin": 10 | node["inputs"]["instantid_file"] = "instantid-ip-adapter.bin" 11 | weights_to_download.append("instantid-ip-adapter.bin") 12 | elif node["class_type"] == "ControlNetLoader": 13 | if "inputs" in node and "control_net_name" in node["inputs"]: 14 | if ( 15 | node["inputs"]["control_net_name"] 16 | == "instantid/diffusion_pytorch_model.safetensors" 17 | ): 18 | node["inputs"][ 19 | "control_net_name" 20 | ] = "instantid-controlnet.safetensors" 21 | weights_to_download.append("instantid-controlnet.safetensors") 22 | -------------------------------------------------------------------------------- /helpers/comfyui.py: -------------------------------------------------------------------------------- 1 | import os 2 | import urllib.request 3 | import subprocess 4 | import threading 5 | import time 6 | import json 7 | import urllib 8 | import uuid 9 | import json 10 | import os 11 | import websocket 12 | import random 13 | from weights_downloader import WeightsDownloader 14 | from urllib.error import URLError 15 | 16 | 17 | # custom_nodes helpers 18 | from helpers.ComfyUI_IPAdapter_plus import ComfyUI_IPAdapter_plus 19 | from helpers.ComfyUI_Controlnet_Aux import ComfyUI_Controlnet_Aux 20 | from helpers.ComfyUI_InstantID import ComfyUI_InstantID 21 | from helpers.ComfyUI_BRIA_AI_RMBG import ComfyUI_BRIA_AI_RMBG 22 | 23 | 24 | class ComfyUI: 25 | def __init__(self, server_address): 26 | self.weights_downloader = WeightsDownloader() 27 | self.server_address = server_address 28 | ComfyUI_IPAdapter_plus.prepare() 29 | 30 | def start_server(self, output_directory, input_directory): 31 | self.input_directory = input_directory 32 | self.output_directory = output_directory 33 | 34 | self.download_pre_start_models() 35 | 36 | server_thread = threading.Thread( 37 | target=self.run_server, args=(output_directory, input_directory) 38 | ) 39 | server_thread.start() 40 | 41 | start_time = time.time() 42 | while not self.is_server_running(): 43 | if time.time() - start_time > 60: # If more than a minute has passed 44 | raise TimeoutError("Server did not start within 60 seconds") 45 | time.sleep(1) # Wait for 1 second before checking again 46 | 47 | print("Server running") 48 | 49 | def run_server(self, output_directory, input_directory): 50 | command = f"python ./ComfyUI/main.py --output-directory {output_directory} --input-directory {input_directory} --disable-metadata" 51 | server_process = subprocess.Popen(command, shell=True) 52 | server_process.wait() 53 | 54 | def is_server_running(self): 55 | try: 56 | with urllib.request.urlopen( 57 | "http://{}/history/{}".format(self.server_address, "123") 58 | ) as response: 59 | return response.status == 200 60 | except URLError: 61 | return False 62 | 63 | def download_pre_start_models(self): 64 | # Some models need to be downloaded and loaded before starting ComfyUI 65 | self.weights_downloader.download_torch_checkpoints() 66 | 67 | def handle_weights(self, workflow): 68 | print("Checking weights") 69 | weights_to_download = [] 70 | weights_filetypes = [ 71 | ".ckpt", 72 | ".safetensors", 73 | ".pt", 74 | ".pth", 75 | ".bin", 76 | ".onnx", 77 | ".torchscript", 78 | ] 79 | 80 | for node in workflow.values(): 81 | for handler in [ 82 | ComfyUI_Controlnet_Aux, 83 | ComfyUI_IPAdapter_plus, 84 | ComfyUI_InstantID, 85 | ComfyUI_BRIA_AI_RMBG, 86 | ]: 87 | handler.add_weights(weights_to_download, node) 88 | 89 | if "inputs" in node: 90 | for input in node["inputs"].values(): 91 | if isinstance(input, str): 92 | if any(input.endswith(ft) for ft in weights_filetypes): 93 | weights_to_download.append(input) 94 | 95 | weights_to_download = list(set(weights_to_download)) 96 | 97 | for weight in weights_to_download: 98 | self.weights_downloader.download_weights(weight) 99 | print(f"✅ {weight}") 100 | 101 | print("====================================") 102 | 103 | def is_image_or_video_value(self, value): 104 | filetypes = [".png", ".jpg", ".jpeg", ".webp", ".mp4", ".webm"] 105 | return isinstance(value, str) and any( 106 | value.lower().endswith(ft) for ft in filetypes 107 | ) 108 | 109 | def handle_inputs(self, workflow): 110 | print("Checking inputs") 111 | seen_inputs = set() 112 | for node in workflow.values(): 113 | if "inputs" in node: 114 | for input_key, input_value in node["inputs"].items(): 115 | if isinstance(input_value, str) and input_value not in seen_inputs: 116 | seen_inputs.add(input_value) 117 | if input_value.startswith(("http://", "https://")): 118 | filename = os.path.join( 119 | self.input_directory, os.path.basename(input_value) 120 | ) 121 | if not os.path.exists(filename): 122 | print(f"Downloading {input_value} to {filename}") 123 | urllib.request.urlretrieve(input_value, filename) 124 | node["inputs"][input_key] = filename 125 | print(f"✅ {filename}") 126 | elif self.is_image_or_video_value(input_value): 127 | filename = os.path.join( 128 | self.input_directory, os.path.basename(input_value) 129 | ) 130 | if not os.path.exists(filename): 131 | print(f"❌ {filename} not provided") 132 | else: 133 | print(f"✅ {filename}") 134 | 135 | print("====================================") 136 | 137 | def connect(self): 138 | self.client_id = str(uuid.uuid4()) 139 | self.ws = websocket.WebSocket() 140 | self.ws.connect(f"ws://{self.server_address}/ws?clientId={self.client_id}") 141 | 142 | def post_request(self, endpoint, data=None): 143 | url = f"http://{self.server_address}{endpoint}" 144 | headers = {"Content-Type": "application/json"} if data else {} 145 | json_data = json.dumps(data).encode("utf-8") if data else None 146 | req = urllib.request.Request( 147 | url, data=json_data, headers=headers, method="POST" 148 | ) 149 | with urllib.request.urlopen(req) as response: 150 | if response.status != 200: 151 | print(f"Failed: {endpoint}, status code: {response.status}") 152 | 153 | # https://github.com/comfyanonymous/ComfyUI/blob/master/server.py 154 | def clear_queue(self): 155 | self.post_request("/queue", {"clear": True}) 156 | self.post_request("/interrupt") 157 | 158 | def queue_prompt(self, prompt): 159 | try: 160 | # Prompt is the loaded workflow (prompt is the label comfyUI uses) 161 | p = {"prompt": prompt, "client_id": self.client_id} 162 | data = json.dumps(p).encode("utf-8") 163 | req = urllib.request.Request( 164 | f"http://{self.server_address}/prompt?{self.client_id}", data=data 165 | ) 166 | 167 | output = json.loads(urllib.request.urlopen(req).read()) 168 | return output["prompt_id"] 169 | except urllib.error.HTTPError as e: 170 | print(f"ComfyUI error: {e.code} {e.reason}") 171 | http_error = True 172 | 173 | if http_error: 174 | raise Exception( 175 | "ComfyUI Error – Your workflow could not be run. This usually happens if you’re trying to use an unsupported node. Check the logs for 'KeyError: ' details, and go to https://github.com/fofr/cog-comfyui to see the list of supported custom nodes." 176 | ) 177 | 178 | def wait_for_prompt_completion(self, workflow, prompt_id): 179 | while True: 180 | out = self.ws.recv() 181 | if isinstance(out, str): 182 | message = json.loads(out) 183 | if message["type"] == "executing": 184 | data = message["data"] 185 | if data["node"] is None and data["prompt_id"] == prompt_id: 186 | break 187 | elif data["prompt_id"] == prompt_id: 188 | node = workflow.get(data["node"], {}) 189 | meta = node.get("_meta", {}) 190 | class_type = node.get("class_type", "Unknown") 191 | print( 192 | f"Executing node {data['node']}, title: {meta.get('title', 'Unknown')}, class type: {class_type}" 193 | ) 194 | else: 195 | continue 196 | 197 | def load_workflow(self, workflow, check_inputs=True, check_weights=True): 198 | if not isinstance(workflow, dict): 199 | wf = json.loads(workflow) 200 | else: 201 | wf = workflow 202 | 203 | # There are two types of ComfyUI JSON 204 | # We need the API version 205 | if any(key in wf.keys() for key in ["last_node_id", "last_link_id", "version"]): 206 | raise ValueError( 207 | "You need to use the API JSON version of a ComfyUI workflow. To do this go to your ComfyUI settings and turn on 'Enable Dev mode Options'. Then you can save your ComfyUI workflow via the 'Save (API Format)' button." 208 | ) 209 | 210 | if check_inputs: 211 | self.handle_inputs(wf) 212 | 213 | if check_weights: 214 | self.handle_weights(wf) 215 | 216 | return wf 217 | 218 | def randomise_input_seed(self, input_key, inputs): 219 | if input_key in inputs and isinstance(inputs[input_key], (int, float)): 220 | new_seed = random.randint(0, 2**32 - 1) 221 | print(f"Randomising {input_key} to {new_seed}") 222 | inputs[input_key] = new_seed 223 | 224 | def randomise_seeds(self, workflow): 225 | for node_id, node in workflow.items(): 226 | inputs = node.get("inputs", {}) 227 | seed_keys = ["seed", "noise_seed", "rand_seed"] 228 | for seed_key in seed_keys: 229 | self.randomise_input_seed(seed_key, inputs) 230 | 231 | def run_workflow(self, workflow): 232 | print("Running workflow") 233 | prompt_id = self.queue_prompt(workflow) 234 | self.wait_for_prompt_completion(workflow, prompt_id) 235 | output_json = self.get_history(prompt_id) 236 | print("outputs: ", output_json) 237 | print("====================================") 238 | 239 | def get_history(self, prompt_id): 240 | with urllib.request.urlopen( 241 | f"http://{self.server_address}/history/{prompt_id}" 242 | ) as response: 243 | output = json.loads(response.read()) 244 | return output[prompt_id]["outputs"] 245 | -------------------------------------------------------------------------------- /predict.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import random 4 | import json 5 | from typing import List 6 | from cog import BasePredictor, Input, Path 7 | from helpers.comfyui import ComfyUI 8 | 9 | OUTPUT_DIR = "/tmp/outputs" 10 | INPUT_DIR = "/tmp/inputs" 11 | COMFYUI_TEMP_OUTPUT_DIR = "ComfyUI/temp" 12 | 13 | with open("face-to-sticker-api.json", "r") as file: 14 | workflow_json = file.read() 15 | 16 | 17 | class Predictor(BasePredictor): 18 | def setup(self): 19 | self.comfyUI = ComfyUI("127.0.0.1:8188") 20 | self.comfyUI.start_server(OUTPUT_DIR, INPUT_DIR) 21 | self.comfyUI.load_workflow( 22 | workflow_json, check_inputs=False 23 | ) 24 | 25 | def cleanup(self): 26 | self.comfyUI.clear_queue() 27 | for directory in [OUTPUT_DIR, INPUT_DIR, COMFYUI_TEMP_OUTPUT_DIR]: 28 | if os.path.exists(directory): 29 | shutil.rmtree(directory) 30 | os.makedirs(directory) 31 | 32 | def handle_input_file(self, input_file: Path): 33 | file_extension = os.path.splitext(input_file)[1].lower() 34 | if file_extension in [".jpg", ".jpeg", ".png", ".webp"]: 35 | filename = f"input{file_extension}" 36 | shutil.copy(input_file, os.path.join(INPUT_DIR, filename)) 37 | else: 38 | raise ValueError(f"Unsupported file type: {file_extension}") 39 | 40 | return filename 41 | 42 | def log_and_collect_files(self, directory, prefix=""): 43 | files = [] 44 | for f in os.listdir(directory): 45 | if f == "__MACOSX": 46 | continue 47 | path = os.path.join(directory, f) 48 | if os.path.isfile(path): 49 | print(f"{prefix}{f}") 50 | files.append(Path(path)) 51 | elif os.path.isdir(path): 52 | print(f"{prefix}{f}/") 53 | files.extend(self.log_and_collect_files(path, prefix=f"{prefix}{f}/")) 54 | return files 55 | 56 | def update_workflow(self, workflow, **kwargs): 57 | loader = workflow["2"]["inputs"] 58 | sampler = workflow["4"]["inputs"] 59 | load_image = workflow["22"]["inputs"] 60 | upscaler = workflow["11"]["inputs"] 61 | instant_id = workflow["41"]["inputs"] 62 | ip_adapter = workflow["43"]["inputs"] 63 | 64 | load_image["image"] = kwargs["filename"] 65 | 66 | loader["cfg"] = kwargs["prompt_strength"] 67 | loader[ 68 | "positive" 69 | ] = f"Sticker, {kwargs['prompt']}, cel shaded, svg, vector art, sharp" 70 | loader[ 71 | "negative" 72 | ] = f"photo, photography, nsfw, nude, ugly, broken, watermark, oversaturated, soft {kwargs['negative_prompt']}" 73 | loader["empty_latent_width"] = kwargs["width"] 74 | loader["empty_latent_height"] = kwargs["height"] 75 | 76 | instant_id["weight"] = kwargs["instant_id_strength"] 77 | 78 | ip_adapter["weight"] = kwargs["ip_adapter_weight"] 79 | ip_adapter["noise"] = kwargs["ip_adapter_noise"] 80 | 81 | sampler["steps"] = kwargs["steps"] 82 | sampler["seed"] = kwargs["seed"] 83 | 84 | if kwargs["upscale"]: 85 | del workflow["5"] 86 | del workflow["9"] 87 | del workflow["10"] 88 | upscaler["steps"] = kwargs["upscale_steps"] 89 | upscaler["seed"] = kwargs["seed"] 90 | else: 91 | for node_id in range(11, 19): 92 | workflow.pop(str(node_id), None) 93 | 94 | def predict( 95 | self, 96 | image: Path = Input( 97 | description="An image of a person to be converted to a sticker", 98 | default=None, 99 | ), 100 | prompt: str = Input(default="a person"), 101 | negative_prompt: str = Input( 102 | default="", 103 | description="Things you do not want in the image", 104 | ), 105 | width: int = Input(default=1024), 106 | height: int = Input(default=1024), 107 | steps: int = Input(default=20), 108 | seed: int = Input( 109 | default=None, description="Fix the random seed for reproducibility" 110 | ), 111 | prompt_strength: float = Input( 112 | default=7, 113 | description="Strength of the prompt. This is the CFG scale, higher numbers lead to stronger prompt, lower numbers will keep more of a likeness to the original.", 114 | ), 115 | instant_id_strength: float = Input( 116 | default=1, description="How strong the InstantID will be.", ge=0, le=1 117 | ), 118 | ip_adapter_weight: float = Input( 119 | default=0.2, 120 | description="How much the IP adapter will influence the image", 121 | ge=0, 122 | le=1, 123 | ), 124 | ip_adapter_noise: float = Input( 125 | default=0.5, 126 | description="How much noise is added to the IP adapter input", 127 | ge=0, 128 | le=1, 129 | ), 130 | upscale: bool = Input(default=False, description="2x upscale the sticker"), 131 | upscale_steps: int = Input( 132 | default=10, description="Number of steps to upscale" 133 | ), 134 | ) -> List[Path]: 135 | """Run a single prediction on the model""" 136 | self.cleanup() 137 | 138 | if image is None: 139 | raise ValueError("No image provided") 140 | 141 | filename = self.handle_input_file(image) 142 | 143 | if seed is None: 144 | seed = random.randint(0, 2**32 - 1) 145 | print(f"Random seed set to: {seed}") 146 | 147 | workflow = json.loads(workflow_json) 148 | self.update_workflow( 149 | workflow, 150 | filename=filename, 151 | seed=seed, 152 | prompt=prompt, 153 | negative_prompt=negative_prompt, 154 | width=width, 155 | height=height, 156 | steps=steps, 157 | upscale=upscale, 158 | upscale_steps=upscale_steps, 159 | prompt_strength=prompt_strength, 160 | instant_id_strength=instant_id_strength, 161 | ip_adapter_weight=ip_adapter_weight, 162 | ip_adapter_noise=ip_adapter_noise, 163 | ) 164 | 165 | wf = self.comfyUI.load_workflow(workflow, check_weights=False) 166 | self.comfyUI.connect() 167 | self.comfyUI.run_workflow(wf) 168 | 169 | files = [] 170 | output_directories = [OUTPUT_DIR] 171 | 172 | for directory in output_directories: 173 | print(f"Contents of {directory}:") 174 | files.extend(self.log_and_collect_files(directory)) 175 | 176 | return files 177 | -------------------------------------------------------------------------------- /scripts/clone_plugins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is used to clone specific versions of repositories. 4 | # It takes a list of repositories and their commit hashes, clones them into a specific directory, 5 | # and then checks out to the specified commit. 6 | 7 | # List of repositories and their commit hashes to clone 8 | # Each entry in the array is a string containing the repository URL and the commit hash separated by a space. 9 | repos=( 10 | "https://github.com/cubiq/ComfyUI_IPAdapter_plus 4e898fe" 11 | "https://github.com/Fannovel16/comfyui_controlnet_aux 6d6f63c" 12 | "https://github.com/jags111/efficiency-nodes-comfyui 1ac5f18" 13 | "https://github.com/ssitu/ComfyUI_UltimateSDUpscale bcefc5b" 14 | "https://github.com/cubiq/ComfyUI_InstantID 0fcf494" 15 | "https://github.com/ZHO-ZHO-ZHO/ComfyUI-BRIA_AI-RMBG 44a3f8f" 16 | ) 17 | 18 | # Destination directory 19 | # This is where the repositories will be cloned into. 20 | dest_dir="ComfyUI/custom_nodes/" 21 | 22 | # Loop over each repository in the list 23 | for repo in "${repos[@]}"; do 24 | # Extract the repository URL and the commit hash from the string 25 | repo_url=$(echo $repo | cut -d' ' -f1) 26 | commit_hash=$(echo $repo | cut -d' ' -f2) 27 | 28 | # Extract the repository name from the URL by removing the .git extension 29 | repo_name=$(basename "$repo_url" .git) 30 | 31 | # Check if the repository directory already exists 32 | if [ ! -d "$dest_dir$repo_name" ]; then 33 | # Clone the repository into the destination directory 34 | echo "Cloning $repo_url into $dest_dir$repo_name and checking out to commit $commit_hash" 35 | git clone --recursive "$repo_url" "$dest_dir$repo_name" 36 | 37 | # Use a subshell to avoid changing the main shell's working directory 38 | # Inside the subshell, change to the repository's directory and checkout to the specific commit 39 | ( 40 | cd "$dest_dir$repo_name" && git checkout "$commit_hash" 41 | rm -rf .git 42 | 43 | # Recursively remove .git directories from submodules 44 | find . -type d -name ".git" -exec rm -rf {} + 45 | 46 | # If the repository is efficiency-nodes-comfyui, also remove the images directory 47 | if [ "$repo_name" = "efficiency-nodes-comfyui" ]; then 48 | echo "Removing images and workflows directories from $repo_name" 49 | rm -rf images workflows 50 | fi 51 | ) 52 | else 53 | echo "Skipping clone for $repo_name, directory already exists" 54 | fi 55 | done 56 | -------------------------------------------------------------------------------- /scripts/get_weights.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | sys.path.append(os.path.join(os.path.dirname(__file__), '..')) 4 | from weights_downloader import WeightsDownloader 5 | 6 | def download_weight_files(weight_files): 7 | wd = WeightsDownloader() 8 | for weight_file in weight_files: 9 | wd.download_weights(weight_file) 10 | 11 | def main(filenames): 12 | weight_files = [] 13 | for filename in filenames: 14 | if filename.endswith('.txt'): 15 | with open(filename, 'r') as f: 16 | weight_files.extend(f.read().splitlines()) 17 | else: 18 | weight_files.append(filename) 19 | download_weight_files(weight_files) 20 | 21 | if __name__ == "__main__": 22 | if len(sys.argv) < 2: 23 | print("Usage: python get_weights.py [ ...] or python get_weights.py ") 24 | sys.exit(1) 25 | filenames = sys.argv[1:] 26 | main(filenames) 27 | -------------------------------------------------------------------------------- /scripts/package_disk_usage.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import os 3 | import shutil 4 | from sys import executable 5 | 6 | # Command: python -m site --user-site 7 | site_packages = '/root/.pyenv/versions/3.10.6/lib/python3.10/site-packages' 8 | 9 | # Command: python -m pip list 10 | installed_packages = subprocess.run([executable, "-m", "pip", "list"], capture_output=True, text=True).stdout 11 | 12 | # Process the output to extract package names 13 | packages = [line.split()[0] for line in installed_packages.split('\n')[2:] if line] 14 | 15 | # Get the size of each package directory in the site-packages 16 | package_sizes = [] 17 | for package in packages: 18 | package_path = os.path.join(site_packages, package) 19 | # Check if the package directory exists (this might not always be accurate) 20 | if os.path.exists(package_path): 21 | # Calculate the directory size using shutil instead of subprocess 22 | total_size = 0 23 | for dirpath, dirnames, filenames in os.walk(package_path): 24 | for f in filenames: 25 | fp = os.path.join(dirpath, f) 26 | # skip if it is symbolic link 27 | if not os.path.islink(fp): 28 | total_size += os.path.getsize(fp) 29 | size = f"{total_size / 1024**2:.2f}MB" 30 | package_sizes.append((package, size)) 31 | else: 32 | # Package might not be in the expected format or location 33 | package_sizes.append((package, "N/A")) 34 | 35 | # Sort packages by size (ignoring those we couldn't get the size for) 36 | package_sizes.sort(key=lambda x: float(x[1].rstrip('MB')) if x[1] != "N/A" else float('-inf'), reverse=True) 37 | 38 | # Print the sizes 39 | for package, size in package_sizes: 40 | print(f"{package}: {size}") 41 | -------------------------------------------------------------------------------- /scripts/reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo rm -rf ComfyUI 3 | git submodule update --init --recursive 4 | ./scripts/clone_plugins.sh 5 | -------------------------------------------------------------------------------- /weights.json: -------------------------------------------------------------------------------- 1 | { 2 | "CHECKPOINTS": [ 3 | "512-inpainting-ema.safetensors", 4 | "absolutereality_v181.safetensors", 5 | "albedobaseXL_v13.safetensors", 6 | "anything-v3-fp16-pruned.safetensors", 7 | "copaxTimelessxlSDXL1_v8.safetensors", 8 | "Deliberate_v2.safetensors", 9 | "dreamlabsoil_V2_v2.safetensors", 10 | "DreamShaper_6.2_BakedVae_pruned.safetensors", 11 | "DreamShaper_6.31_BakedVae.safetensors", 12 | "DreamShaper_6.31_BakedVae_pruned.safetensors", 13 | "DreamShaper_6.31_INPAINTING.inpainting.safetensors", 14 | "DreamShaper_6_BakedVae.safetensors", 15 | "dreamshaper_8.safetensors", 16 | "dreamshaper_8LCM.safetensors", 17 | "dreamshaperXL_alpha2Xl10.safetensors", 18 | "dreamshaperXL_lightningDPMSDE.safetensors", 19 | "epicrealism_naturalSinRC1VAE.safetensors", 20 | "epicrealismXL_v10.safetensors", 21 | "juggernautXL_v8Rundiffusion.safetensors", 22 | "LCM_Dreamshaper_v7_4k.safetensors", 23 | "motionctrl.pth", 24 | "motionctrl_svd.ckpt", 25 | "playground-v2.5-1024px-aesthetic.fp16.safetensors", 26 | "proteus_v02.safetensors", 27 | "ProteusV0.4-Lighting.safetensors", 28 | "ProteusV0.4.safetensors", 29 | "Realistic_Vision_V5.1-inpainting.ckpt", 30 | "Realistic_Vision_V5.1-inpainting.safetensors", 31 | "Realistic_Vision_V5.1.ckpt", 32 | "Realistic_Vision_V5.1.safetensors", 33 | "Realistic_Vision_V5.1_fp16-no-ema-inpainting.ckpt", 34 | "Realistic_Vision_V5.1_fp16-no-ema-inpainting.safetensors", 35 | "Realistic_Vision_V5.1_fp16-no-ema.ckpt", 36 | "Realistic_Vision_V5.1_fp16-no-ema.safetensors", 37 | "Realistic_Vision_V6.0_NV_B1.safetensors", 38 | "Realistic_Vision_V6.0_NV_B1_fp16.safetensors", 39 | "Realistic_Vision_V6.0_NV_B1_inpainting.safetensors", 40 | "Realistic_Vision_V6.0_NV_B1_inpainting_fp16.safetensors", 41 | "RealVisXL_V2.0.safetensors", 42 | "RealVisXL_V3.0.safetensors", 43 | "RealVisXL_V3.0_Turbo.safetensors", 44 | "RealVisXL_V4.0.safetensors", 45 | "sd_xl_base_1.0.safetensors", 46 | "sd_xl_base_1.0_0.9vae.safetensors", 47 | "sd_xl_refiner_1.0.safetensors", 48 | "sd_xl_refiner_1.0_0.9vae.safetensors", 49 | "sd_xl_turbo_1.0.safetensors", 50 | "sd_xl_turbo_1.0_fp16.safetensors", 51 | "sdxl_lightning_1step_x0.safetensors", 52 | "sdxl_lightning_2step.safetensors", 53 | "sdxl_lightning_4step.safetensors", 54 | "sdxl_lightning_8step.safetensors", 55 | "segmind-vega.safetensors", 56 | "SSD-1B.safetensors", 57 | "starlightXLAnimated_v3.safetensors", 58 | "svd.safetensors", 59 | "svd_xt.safetensors", 60 | "turbovisionxlSuperFastXLBasedOnNew_tvxlV32Bakedvae.safetensors", 61 | "v1-5-pruned-emaonly.ckpt", 62 | "v2-1_512-ema-pruned.safetensors", 63 | "v2-1_768-ema-pruned.ckpt", 64 | "v2-1_768-ema-pruned.safetensors", 65 | "v2-1_768-nonema-pruned.ckpt", 66 | "v2-1_768-nonema-pruned.safetensors", 67 | "wd-illusion-fp16.safetensors", 68 | "x4-upscaler-ema.safetensors" 69 | ], 70 | "UPSCALE_MODELS": [ 71 | "4x-AnimeSharp.pth", 72 | "4x-UltraMix_Balanced.pth", 73 | "4x-UltraMix_Smooth.pth", 74 | "4x-UltraSharp.pth", 75 | "4x_foolhardy_Remacri.pth", 76 | "4x_NMKD-Siax_200k.pth", 77 | "8x_NMKD-Superscale_150000_G.pth", 78 | "ESRGAN_4x.pth", 79 | "RealESRGAN_x2.pth", 80 | "RealESRGAN_x4.pth", 81 | "RealESRGAN_x4plus.pth", 82 | "RealESRGAN_x4plus_anime_6B.pth", 83 | "RealESRGAN_x8.pth" 84 | ], 85 | "CLIP_VISION": [ 86 | "CLIP-ViT-bigG-14-laion2B-39B-b160k.safetensors", 87 | "CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors", 88 | "clip-vit-large-patch14.bin", 89 | "clip_vision_g.safetensors", 90 | "IPAdapter_image_encoder_sd15.safetensors", 91 | "model.15.safetensors", 92 | "model.sdxl.safetensors" 93 | ], 94 | "LORAS": [ 95 | "artificialguybr/3DRedmond-3DRenderStyle-3DRenderAF.safetensors", 96 | "artificialguybr/AnalogRedmond-AnalogRedmAF.safetensors", 97 | "artificialguybr/AnalogRedmondV2-Analog-AnalogRedmAF.safetensors", 98 | "artificialguybr/BetterTextRedmond.safetensors", 99 | "artificialguybr/ClayAnimationRedm.safetensors", 100 | "artificialguybr/ClayAnimationRedmond15-ClayAnimation-Clay.safetensors", 101 | "artificialguybr/ColoringBookRedmond-ColoringBook-ColoringBookAF.safetensors", 102 | "artificialguybr/ColoringBookRedmond-ColoringBookAF.safetensors", 103 | "artificialguybr/ColoringBookRedmond21V-FreedomRedmond-ColoringBook-ColoringBookAF.safetensors", 104 | "artificialguybr/CuteCartoon15V-LiberteRedmodModel-Cartoon-CuteCartoonAF.safetensors", 105 | "artificialguybr/CuteCartoonRedmond-CuteCartoon-CuteCartoonAF.safetensors", 106 | "artificialguybr/CuteFruitsRedmond-CtFruitsRedmAF.safetensors", 107 | "artificialguybr/FilmGrainRedmond-FilmGrain-FilmGrainAF.safetensors", 108 | "artificialguybr/IconsRedmond.safetensors", 109 | "artificialguybr/IconsRedmond15V-Icons.safetensors", 110 | "artificialguybr/IconsRedmondV2-Icons.safetensors", 111 | "artificialguybr/LineAniRedmond-LineAniAF.safetensors", 112 | "artificialguybr/LineAniRedmondV2-Lineart-LineAniAF.safetensors", 113 | "artificialguybr/LogoRedmond15V-LogoRedmAF-Logo.safetensors", 114 | "artificialguybr/LogoRedmond_LogoRedAF.safetensors", 115 | "artificialguybr/LogoRedmondV2-Logo-LogoRedmAF.safetensors", 116 | "artificialguybr/MoviePosterRedmond-MoviePoster-MoviePosterRedAF.safetensors", 117 | "artificialguybr/PixelArtRedmond-Lite64.safetensors", 118 | "artificialguybr/PixelArtRedmond15V-PixelArt-PIXARFK.safetensors", 119 | "artificialguybr/PomologicalWatercolorRedmond.safetensors", 120 | "artificialguybr/PS1Redmond-PS1Game-Playstation1Graphics.safetensors", 121 | "artificialguybr/StickersRedmond.safetensors", 122 | "artificialguybr/StickersRedmond15Version-Stickers-Sticker.safetensors", 123 | "artificialguybr/StickersRedmond21V-FreedomRedmond-Sticker-Stickers.safetensors", 124 | "artificialguybr/StoryBookRedmond-KidsRedmAF.safetensors", 125 | "artificialguybr/StoryBookRedmond15-KidsRedmAF-KidsBook.safetensors", 126 | "artificialguybr/StorybookRedmondUnbound-KidsRedmAF.safetensors", 127 | "artificialguybr/StorybookRedmondV2-KidsBook-KidsRedmAF.safetensors", 128 | "artificialguybr/StudioGhibli.Redmond-StdGBRRedmAF-StudioGhibli.safetensors", 129 | "artificialguybr/StudioGhibliRedmond-StdGBRedmAF.safetensors", 130 | "artificialguybr/ToyRedmond-FnkRedmAF.safetensors", 131 | "artificialguybr/TshirtDesignRedmond-TshirtDesignAF.safetensors", 132 | "artificialguybr/TShirtDesignRedmondV2-Tshirtdesign-TshirtDesignAF.safetensors", 133 | "artificialguybr/View360.safetensors", 134 | "COOLKIDS_MERGE_V2.5.safetensors", 135 | "Harrlogos_v2.0.safetensors", 136 | "ip-adapter-faceid-plus_sd15_lora.safetensors", 137 | "ip-adapter-faceid-plusv2_sd15_lora.safetensors", 138 | "ip-adapter-faceid-plusv2_sdxl_lora.safetensors", 139 | "ip-adapter-faceid_sd15_lora.safetensors", 140 | "ip-adapter-faceid_sdxl_lora.safetensors", 141 | "lcm-lora-sdv1-5.safetensors", 142 | "lcm-lora-ssd-1b.safetensors", 143 | "lcm_lora_sdxl.safetensors", 144 | "MODILL_XL_0.27_RC.safetensors", 145 | "more_details.safetensors", 146 | "PerfectEyesXL.safetensors", 147 | "sd_xl_offset_example-lora_1.0.safetensors", 148 | "sdxl_lightning_2step_lora.pth", 149 | "sdxl_lightning_2step_lora.safetensors", 150 | "sdxl_lightning_4step_lora.pth", 151 | "sdxl_lightning_4step_lora.safetensors", 152 | "sdxl_lightning_8step_lora.pth", 153 | "sdxl_lightning_8step_lora.safetensors", 154 | "Segmind-VegaRT.safetensors", 155 | "theovercomer8sContrastFix_sd15.safetensors", 156 | "theovercomer8sContrastFix_sd21768.safetensors" 157 | ], 158 | "EMBEDDINGS": [ 159 | "bad_prompt_version2-neg.pt", 160 | "easynegative.safetensors", 161 | "FastNegativeV2.pt", 162 | "negative_hand-neg.pt", 163 | "ng_deepnegative_v1_75t.pt" 164 | ], 165 | "CONTROLNET": [ 166 | "control-lora-canny-rank128.safetensors", 167 | "control-lora-canny-rank256.safetensors", 168 | "control-lora-depth-rank128.safetensors", 169 | "control-lora-depth-rank256.safetensors", 170 | "control-lora-recolor-rank128.safetensors", 171 | "control-lora-recolor-rank256.safetensors", 172 | "control-lora-sketch-rank128-metadata.safetensors", 173 | "control-lora-sketch-rank256.safetensors", 174 | "control_boxdepth_LooseControlfp16.safetensors", 175 | "control_lora_rank128_v11e_sd15_ip2p_fp16.safetensors", 176 | "control_lora_rank128_v11e_sd15_shuffle_fp16.safetensors", 177 | "control_lora_rank128_v11f1e_sd15_tile_fp16.safetensors", 178 | "control_lora_rank128_v11f1p_sd15_depth_fp16.safetensors", 179 | "control_lora_rank128_v11p_sd15_canny_fp16.safetensors", 180 | "control_lora_rank128_v11p_sd15_inpaint_fp16.safetensors", 181 | "control_lora_rank128_v11p_sd15_lineart_fp16.safetensors", 182 | "control_lora_rank128_v11p_sd15_mlsd_fp16.safetensors", 183 | "control_lora_rank128_v11p_sd15_normalbae_fp16.safetensors", 184 | "control_lora_rank128_v11p_sd15_openpose_fp16.safetensors", 185 | "control_lora_rank128_v11p_sd15_scribble_fp16.safetensors", 186 | "control_lora_rank128_v11p_sd15_seg_fp16.safetensors", 187 | "control_lora_rank128_v11p_sd15_softedge_fp16.safetensors", 188 | "control_lora_rank128_v11p_sd15s2_lineart_anime_fp16.safetensors", 189 | "control_sd15_inpaint_depth_hand_fp16.safetensors", 190 | "control_v11e_sd15_ip2p.pth", 191 | "control_v11e_sd15_ip2p_fp16.safetensors", 192 | "control_v11e_sd15_shuffle.pth", 193 | "control_v11e_sd15_shuffle_fp16.safetensors", 194 | "control_v11f1e_sd15_tile.pth", 195 | "control_v11f1e_sd15_tile_fp16.safetensors", 196 | "control_v11f1p_sd15_depth.pth", 197 | "control_v11f1p_sd15_depth_fp16.safetensors", 198 | "control_v11p_sd15_canny.pth", 199 | "control_v11p_sd15_canny_fp16.safetensors", 200 | "control_v11p_sd15_inpaint.pth", 201 | "control_v11p_sd15_inpaint_fp16.safetensors", 202 | "control_v11p_sd15_lineart.pth", 203 | "control_v11p_sd15_lineart_fp16.safetensors", 204 | "control_v11p_sd15_mlsd.pth", 205 | "control_v11p_sd15_mlsd_fp16.safetensors", 206 | "control_v11p_sd15_normalbae.pth", 207 | "control_v11p_sd15_normalbae_fp16.safetensors", 208 | "control_v11p_sd15_openpose.pth", 209 | "control_v11p_sd15_openpose_fp16.safetensors", 210 | "control_v11p_sd15_scribble.pth", 211 | "control_v11p_sd15_scribble_fp16.safetensors", 212 | "control_v11p_sd15_seg.pth", 213 | "control_v11p_sd15_seg_fp16.safetensors", 214 | "control_v11p_sd15_softedge.pth", 215 | "control_v11p_sd15_softedge_fp16.safetensors", 216 | "control_v11p_sd15s2_lineart_anime.pth", 217 | "control_v11p_sd15s2_lineart_anime_fp16.safetensors", 218 | "control_v11u_sd15_tile_fp16.safetensors", 219 | "controllllite_v01032064e_sdxl_canny_anime.safetensors", 220 | "controlnet-canny-sdxl-1.0.fp16.safetensors", 221 | "controlnet-depth-sdxl-1.0.fp16.safetensors", 222 | "controlnet-sd-xl-1.0-softedge-dexined.safetensors", 223 | "controlnet-temporalnet-sdxl-1.0.safetensors", 224 | "depth-zoe-xl-v1.0-controlnet.safetensors", 225 | "diffusers_xl_canny_full.safetensors", 226 | "diffusers_xl_canny_mid.safetensors", 227 | "diffusers_xl_canny_small.safetensors", 228 | "diffusers_xl_depth_full.safetensors", 229 | "diffusers_xl_depth_mid.safetensors", 230 | "diffusers_xl_depth_small.safetensors", 231 | "instantid-controlnet.safetensors", 232 | "ioclab_sd15_recolor.safetensors", 233 | "ip-adapter_sd15.pth", 234 | "ip-adapter_sd15_plus.pth", 235 | "ip-adapter_xl.pth", 236 | "kohya_controllllite_xl_blur.safetensors", 237 | "kohya_controllllite_xl_blur_anime.safetensors", 238 | "kohya_controllllite_xl_blur_anime_beta.safetensors", 239 | "kohya_controllllite_xl_canny.safetensors", 240 | "kohya_controllllite_xl_canny_anime.safetensors", 241 | "kohya_controllllite_xl_depth.safetensors", 242 | "kohya_controllllite_xl_depth_anime.safetensors", 243 | "kohya_controllllite_xl_openpose_anime.safetensors", 244 | "kohya_controllllite_xl_openpose_anime_v2.safetensors", 245 | "kohya_controllllite_xl_scribble_anime.safetensors", 246 | "OpenPoseXL2.safetensors", 247 | "sai_xl_canny_128lora.safetensors", 248 | "sai_xl_canny_256lora.safetensors", 249 | "sai_xl_depth_128lora.safetensors", 250 | "sai_xl_depth_256lora.safetensors", 251 | "sai_xl_recolor_128lora.safetensors", 252 | "sai_xl_recolor_256lora.safetensors", 253 | "sai_xl_sketch_128lora.safetensors", 254 | "sai_xl_sketch_256lora.safetensors", 255 | "sargezt_xl_depth.safetensors", 256 | "sargezt_xl_depth_faid_vidit.safetensors", 257 | "sargezt_xl_depth_zeed.safetensors", 258 | "sargezt_xl_softedge.safetensors", 259 | "t2i-adapter_diffusers_xl_canny.safetensors", 260 | "t2i-adapter_diffusers_xl_depth_midas.safetensors", 261 | "t2i-adapter_diffusers_xl_depth_zoe.safetensors", 262 | "t2i-adapter_diffusers_xl_lineart.safetensors", 263 | "t2i-adapter_diffusers_xl_openpose.safetensors", 264 | "t2i-adapter_diffusers_xl_sketch.safetensors", 265 | "t2i-adapter_xl_canny.safetensors", 266 | "t2i-adapter_xl_openpose.safetensors", 267 | "t2i-adapter_xl_sketch.safetensors", 268 | "t2iadapter_canny_sd14v1.pth", 269 | "t2iadapter_color_sd14v1.pth", 270 | "t2iadapter_depth_sd14v1.pth", 271 | "t2iadapter_keypose_sd14v1.pth", 272 | "t2iadapter_openpose_sd14v1.pth", 273 | "t2iadapter_seg_sd14v1.pth", 274 | "t2iadapter_sketch_sd14v1.pth", 275 | "t2iadapter_style_sd14v1.pth", 276 | "temporalnetversion2.ckpt", 277 | "thibaud_xl_openpose.safetensors", 278 | "thibaud_xl_openpose_256lora.safetensors" 279 | ], 280 | "IPADAPTER": [ 281 | "ip-adapter-faceid-plus_sd15.bin", 282 | "ip-adapter-faceid-plusv2_sd15.bin", 283 | "ip-adapter-faceid-plusv2_sdxl.bin", 284 | "ip-adapter-faceid-portrait_sd15.bin", 285 | "ip-adapter-faceid_sd15.bin", 286 | "ip-adapter-faceid_sdxl.bin", 287 | "ip-adapter-full-face_sd15.bin", 288 | "ip-adapter-full-face_sd15.safetensors", 289 | "ip-adapter-plus-face_sd15.bin", 290 | "ip-adapter-plus-face_sd15.safetensors", 291 | "ip-adapter-plus-face_sdxl_vit-h.bin", 292 | "ip-adapter-plus-face_sdxl_vit-h.safetensors", 293 | "ip-adapter-plus_sd15.bin", 294 | "ip-adapter-plus_sd15.safetensors", 295 | "ip-adapter-plus_sdxl_vit-h.bin", 296 | "ip-adapter-plus_sdxl_vit-h.safetensors", 297 | "ip-adapter_sd15.bin", 298 | "ip-adapter_sd15.safetensors", 299 | "ip-adapter_sd15_light.bin", 300 | "ip-adapter_sd15_light.safetensors", 301 | "ip-adapter_sd15_vit-G.bin", 302 | "ip-adapter_sd15_vit-G.safetensors", 303 | "ip-adapter_sdxl.safetensors", 304 | "ip-adapter_sdxl_vit-h.safetensors" 305 | ], 306 | "VAE": [ 307 | "sdxl_vae.safetensors", 308 | "vae-ft-mse-840000-ema-pruned.safetensors" 309 | ], 310 | "UNET": [ 311 | "sdxl_lightning_1step_unet_x0.pth", 312 | "sdxl_lightning_1step_unet_x0.safetensors", 313 | "sdxl_lightning_2step_unet.pth", 314 | "sdxl_lightning_2step_unet.safetensors", 315 | "sdxl_lightning_4step_unet.pth", 316 | "sdxl_lightning_4step_unet.safetensors", 317 | "sdxl_lightning_8step_unet.pth", 318 | "sdxl_lightning_8step_unet.safetensors" 319 | ], 320 | "PHOTOMAKER": [ 321 | "photomaker-v1.bin" 322 | ], 323 | "INSTANTID": [ 324 | "instantid-ip-adapter.bin" 325 | ], 326 | "INSIGHTFACE": [ 327 | "antelopev2", 328 | "buffalo_l", 329 | "inswapper_128.onnx", 330 | "inswapper_128_fp16.onnx" 331 | ], 332 | "FACEDETECTION": [ 333 | "detection_mobilenet0.25_Final.pth", 334 | "detection_Resnet50_Final.pth", 335 | "parsing_parsenet.pth", 336 | "yolov5l-face.pth", 337 | "yolov5n-face.pth" 338 | ], 339 | "FACERESTORE_MODELS": [ 340 | "codeformer.pth", 341 | "GFPGANv1.3.pth", 342 | "GFPGANv1.4.pth", 343 | "RestoreFormer.pth" 344 | ], 345 | "MMDETS": [ 346 | "bbox/mmdet_anime-face_yolov3.pth" 347 | ], 348 | "SAMS": [ 349 | "mobile_sam.pt", 350 | "sam_hq_vit_b.pth", 351 | "sam_hq_vit_h.pth", 352 | "sam_hq_vit_l.pth", 353 | "sam_vit_b_01ec64.pth", 354 | "sam_vit_h_4b8939.pth", 355 | "sam_vit_l_0b3195.pth" 356 | ], 357 | "GROUNDING-DINO": [ 358 | "groundingdino_swinb_cogcoor.pth", 359 | "groundingdino_swint_ogc.pth" 360 | ], 361 | "BERT-BASE-UNCASED": [ 362 | "bert-base-uncased" 363 | ], 364 | "ULTRALYTICS": [ 365 | "bbox/face_yolov8m.pt", 366 | "bbox/hand_yolov8s.pt", 367 | "segm/person_yolov8m-seg.pt" 368 | ] 369 | } -------------------------------------------------------------------------------- /weights_downloader.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import time 3 | import os 4 | 5 | from weights_manifest import WeightsManifest 6 | 7 | BASE_URL = "https://weights.replicate.delivery/default/comfy-ui" 8 | 9 | 10 | class WeightsDownloader: 11 | def __init__(self): 12 | self.weights_manifest = WeightsManifest() 13 | self.weights_map = self.weights_manifest.weights_map 14 | 15 | def download_weights(self, weight_str): 16 | if weight_str in self.weights_map: 17 | if self.weights_manifest.is_non_commercial_only(weight_str): 18 | print( 19 | f"⚠️ {weight_str} is for non-commercial use only. Unless you have obtained a commercial license.\nDetails: https://github.com/fofr/cog-comfyui/blob/main/weights_licenses.md" 20 | ) 21 | self.download_if_not_exists( 22 | weight_str, 23 | self.weights_map[weight_str]["url"], 24 | self.weights_map[weight_str]["dest"], 25 | ) 26 | else: 27 | raise ValueError( 28 | f"{weight_str} unavailable. View the list of available weights: https://github.com/fofr/cog-comfyui/blob/main/supported_weights.md" 29 | ) 30 | 31 | def download_torch_checkpoints(self): 32 | self.download_if_not_exists( 33 | "mobilenet_v2-b0353104.pth", 34 | f"{BASE_URL}/custom_nodes/comfyui_controlnet_aux/mobilenet_v2-b0353104.pth.tar", 35 | "/root/.cache/torch/hub/checkpoints/", 36 | ) 37 | 38 | def download_if_not_exists(self, weight_str, url, dest): 39 | if not os.path.exists(f"{dest}/{weight_str}"): 40 | self.download(weight_str, url, dest) 41 | 42 | def download(self, weight_str, url, dest): 43 | if "/" in weight_str: 44 | subfolder = weight_str.rsplit("/", 1)[0] 45 | dest = os.path.join(dest, subfolder) 46 | os.makedirs(dest, exist_ok=True) 47 | 48 | print(f"⏳ Downloading {weight_str} to {dest}") 49 | start = time.time() 50 | subprocess.check_call( 51 | ["pget", "--log-level", "warn", "-xf", url, dest], close_fds=False 52 | ) 53 | elapsed_time = time.time() - start 54 | try: 55 | file_size_bytes = os.path.getsize( 56 | os.path.join(dest, os.path.basename(weight_str)) 57 | ) 58 | file_size_megabytes = file_size_bytes / (1024 * 1024) 59 | print( 60 | f"⌛️ Downloaded {weight_str} in {elapsed_time:.2f}s, size: {file_size_megabytes:.2f}MB" 61 | ) 62 | except FileNotFoundError: 63 | print(f"⌛️ Downloaded {weight_str} in {elapsed_time:.2f}s") 64 | -------------------------------------------------------------------------------- /weights_licenses.md: -------------------------------------------------------------------------------- 1 | # Weights licenses 2 | 3 | Some weights used in this model cannot be used commercially. See details below. 4 | 5 | ## Non-commercial weights 6 | 7 | ### BRIA AI RMBG 1.4 8 | 9 | BRIA AI’s remove background tool cannot be used commercially without prior agreement. [See full licence details](https://bria.ai/bria-huggingface-model-license-agreement/) 10 | 11 | - RMBG-1.4/model.pth 12 | 13 | ### inswapper_128.onnx, inswapper_128_fp16.onnx, antelopev2 and buffalo_l 14 | 15 | InsightFace FaceSwap models are non-commercial research only 16 | 17 | https://github.com/deepinsight/insightface?tab=readme-ov-file#license 18 | -------------------------------------------------------------------------------- /weights_manifest.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import time 3 | import os 4 | import json 5 | 6 | from helpers.ComfyUI_Controlnet_Aux import ComfyUI_Controlnet_Aux 7 | from helpers.ComfyUI_BRIA_AI_RMBG import ComfyUI_BRIA_AI_RMBG 8 | 9 | UPDATED_WEIGHTS_MANIFEST_URL = f"https://weights.replicate.delivery/default/comfy-ui/weights.json?cache_bypass={int(time.time())}" 10 | UPDATED_WEIGHTS_MANIFEST_PATH = "updated_weights.json" 11 | WEIGHTS_MANIFEST_PATH = "weights.json" 12 | 13 | BASE_URL = "https://weights.replicate.delivery/default/comfy-ui" 14 | BASE_PATH = "ComfyUI/models" 15 | 16 | 17 | class WeightsManifest: 18 | def __init__(self): 19 | self.weights_manifest = self._load_weights_manifest() 20 | self.weights_map = self._initialize_weights_map() 21 | 22 | def _load_weights_manifest(self): 23 | self._download_updated_weights_manifest() 24 | return self._merge_manifests() 25 | 26 | def _download_updated_weights_manifest(self): 27 | if not os.path.exists(UPDATED_WEIGHTS_MANIFEST_PATH): 28 | print( 29 | f"Downloading updated weights manifest from {UPDATED_WEIGHTS_MANIFEST_URL}" 30 | ) 31 | start = time.time() 32 | subprocess.check_call( 33 | [ 34 | "pget", 35 | "--log-level", 36 | "warn", 37 | "-f", 38 | UPDATED_WEIGHTS_MANIFEST_URL, 39 | UPDATED_WEIGHTS_MANIFEST_PATH, 40 | ], 41 | close_fds=False, 42 | ) 43 | print( 44 | f"Downloading {UPDATED_WEIGHTS_MANIFEST_URL} took: {(time.time() - start):.2f}s" 45 | ) 46 | else: 47 | print("Updated weights manifest file already exists") 48 | 49 | def _merge_manifests(self): 50 | if os.path.exists(WEIGHTS_MANIFEST_PATH): 51 | with open(WEIGHTS_MANIFEST_PATH, "r") as f: 52 | original_manifest = json.load(f) 53 | else: 54 | original_manifest = {} 55 | 56 | with open(UPDATED_WEIGHTS_MANIFEST_PATH, "r") as f: 57 | updated_manifest = json.load(f) 58 | 59 | for key in updated_manifest: 60 | if key in original_manifest: 61 | for item in updated_manifest[key]: 62 | if item not in original_manifest[key]: 63 | print(f"Adding {item} to {key}") 64 | original_manifest[key].append(item) 65 | else: 66 | original_manifest[key] = updated_manifest[key] 67 | 68 | return original_manifest 69 | 70 | def _generate_weights_map(self, keys, dest): 71 | return { 72 | key: { 73 | "url": f"{BASE_URL}/{dest}/{key}.tar", 74 | "dest": f"{BASE_PATH}/{dest}", 75 | } 76 | for key in keys 77 | } 78 | 79 | def _initialize_weights_map(self): 80 | weights_map = {} 81 | for key in self.weights_manifest.keys(): 82 | if key.isupper(): 83 | weights_map.update( 84 | self._generate_weights_map(self.weights_manifest[key], key.lower()) 85 | ) 86 | weights_map.update(ComfyUI_Controlnet_Aux.weights_map(BASE_URL)) 87 | weights_map.update(ComfyUI_BRIA_AI_RMBG.weights_map(BASE_URL)) 88 | 89 | print("Allowed weights:") 90 | for weight in weights_map.keys(): 91 | print(weight) 92 | 93 | return weights_map 94 | 95 | def non_commercial_weights(self): 96 | return [ 97 | "inswapper_128.onnx", 98 | "inswapper_128_fp16.onnx", 99 | "proteus_v02.safetensors", 100 | "RealVisXL_V3.0_Turbo.safetensors", 101 | "sd_xl_turbo_1.0.safetensors", 102 | "sd_xl_turbo_1.0_fp16.safetensors", 103 | "svd.safetensors", 104 | "svd_xt.safetensors", 105 | "turbovisionxlSuperFastXLBasedOnNew_tvxlV32Bakedvae", 106 | "copaxTimelessxlSDXL1_v8.safetensors", 107 | "MODILL_XL_0.27_RC.safetensors", 108 | "epicrealismXL_v10.safetensors", 109 | "RMBG-1.4/model.pth", 110 | ] 111 | 112 | def is_non_commercial_only(self, weight_str): 113 | return weight_str in self.non_commercial_weights() 114 | --------------------------------------------------------------------------------