├── DeepCache_Fix.py ├── README.md ├── __init__.py └── doc ├── DeepCache-Fix.json ├── icon.png └── img.png /DeepCache_Fix.py: -------------------------------------------------------------------------------- 1 | import torch 2 | from comfy.ldm.modules.diffusionmodules.openaimodel import forward_timestep_embed, timestep_embedding, th, apply_control 3 | 4 | class DeepCache_Fix: 5 | 6 | @classmethod 7 | def INPUT_TYPES(s): 8 | 9 | """ 10 | 静态方法,用于定义输入参数的类型和默认值。 11 | 12 | 该方法返回一个字典,其中包含了不同输入参数的配置信息。每个输入参数都是一个键值对, 13 | 键表示参数名,值是一个元组,包含参数的类型和一个字典,该字典描述了参数的更多细节, 14 | 如默认值、最小值、最大值等。 15 | 16 | 返回: 17 | dict: 包含所有输入参数配置的字典。 18 | """ 19 | return { 20 | "required": { 21 | "model": ("MODEL",), 22 | "cache_interval": ("INT", { 23 | "default": 3, 24 | "min": 1, 25 | "max": 1000, 26 | "step": 1, 27 | "display": "number" 28 | }), 29 | "cache_depth": ("INT", { 30 | "default": 3, 31 | "min": 0, 32 | "max": 12, 33 | "step": 1, 34 | "display": "number" 35 | }), 36 | "start_steps": ("INT", { 37 | "default": 0, 38 | "min": 0, 39 | "max": 100, 40 | "step": 1, 41 | "display": "number" 42 | }), 43 | "end_steps": ("INT", { 44 | "default": 12, 45 | "min": 0, 46 | "max": 100, 47 | "step": 1, 48 | "display": "number" 49 | }), 50 | "input_cache": (["No", "Yes"], {"default":"Yes"}), 51 | "middle_cahce": (["No", "Yes"], {"default":"Yes"}), 52 | "output_cache": (["No", "Yes"], {"default":"Yes"}), 53 | }, 54 | } 55 | 56 | RETURN_TYPES = ("MODEL",) 57 | FUNCTION = "apply" 58 | CATEGORY = "loaders" 59 | 60 | def apply(self, model, cache_interval, cache_depth, start_steps, end_steps, input_cache, middle_cahce, output_cache): 61 | # 初始化一些变量 62 | current_time = -1 63 | current_step = -1 64 | model_step = 0 65 | cache_h = None 66 | 67 | # 创建一个新的模型副本,用于存储修改后的模型。 68 | new_model = model.clone() 69 | # 获取并初始化模型的扩散部分。 70 | unet = new_model.model.diffusion_model 71 | # 获取并初始化模型的扩散部分。 72 | dtype = new_model.model.get_dtype() 73 | 74 | def cache_apply_methon(current, start, end): 75 | """ 76 | 判断当前步骤是否在指定的开始步骤和结束步骤范围内。 77 | 78 | 参数: 79 | current -- 当前的步骤数 80 | start -- 范围的起始步骤数 81 | end -- 范围的结束步骤数 82 | 83 | 返回: 84 | 如果当前步骤在指定范围内,则返回True;否则返回False。 85 | """ 86 | return start <= current <= end 87 | 88 | def apply_model(model_function, kwargs): 89 | """ 90 | 应用模型函数到给定的输入上。 91 | 92 | 这个函数处理模型的输入和输出,包括数据类型转换、条件的添加和模型的分块计算。 93 | 它还处理缓存机制,以在多次调用之间复用计算结果,提高效率。 94 | 95 | :param model_function: 模型函数,一个接受kwargs参数的函数。 96 | :param kwargs: 包含模型输入和配置的字典。包括输入数据、时间步、条件等。 97 | :return: 模型处理后的输出。 98 | """ 99 | 100 | # 声明一些非局部变量,用于处理缓存和当前时间步等状态。 101 | nonlocal model_step, cache_h, current_time, current_step 102 | 103 | # 从kwargs中提取必要的输入和配置。 104 | xa = kwargs["input"] 105 | t = kwargs["timestep"] 106 | c_concat = kwargs["c"].get("c_concat", None) 107 | c_crossattn = kwargs["c"].get("c_crossattn", None) 108 | y = kwargs["c"].get("y", None) 109 | control = kwargs["c"].get("control", None) 110 | transformer_options = kwargs["c"].get("transformer_options", None) 111 | 112 | # 根据当前时间步计算输入xc。 113 | sigma = t 114 | xc = new_model.model.model_sampling.calculate_input(sigma, xa) 115 | if c_concat is not None: 116 | # 将输入xc与跨注意力的上下文c_concat进行拼接。 117 | xc = torch.cat([xc] + [c_concat], dim=1) 118 | 119 | # 处理跨注意力的上下文和数据类型的转换。 120 | context = c_crossattn 121 | xc = xc.to(dtype) 122 | # 将时间步转换为指定的数据类型。 123 | t = new_model.model.model_sampling.timestep(t).float() 124 | context = context.to(dtype) 125 | 126 | # 将所有额外的条件转换为指定的数据类型。 127 | extra_conds = {} 128 | for o in kwargs: 129 | extra = kwargs[o] 130 | if hasattr(extra, "to"): 131 | extra = extra.to(dtype) 132 | extra_conds[o] = extra 133 | 134 | # 初始化模型的输入和配置。 135 | x = xc 136 | timesteps = t 137 | y = None if y is None else y.to(dtype) 138 | transformer_options["original_shape"] = list(x.shape) 139 | transformer_options["current_index"] = 0 140 | transformer_patches = transformer_options.get("patches", {}) 141 | 142 | model_step += 1 143 | # 更新当前时间步和缓存状态,根据当前时间步决定是否应用模型。 144 | if t[0].item() > current_time: 145 | model_step = 0 146 | current_step = -1 147 | # 判断是否需要应用模型,根据当前时间步和指定的时间范围。 148 | cache_apply = cache_apply_methon(model_step, start_steps, end_steps) 149 | if cache_apply: 150 | current_step += 1 151 | else: 152 | current_step = -1 153 | current_time = t[0].item() 154 | # print(f"model_step: {model_step}, {cache_apply}") 155 | 156 | # 确保如果模型是分类的,那么必须提供标签y。 157 | assert (y is not None) == ( 158 | unet.num_classes is not None 159 | ), "must specify y if and only if the model is class-conditional" 160 | 161 | # 处理时间嵌入和模型的输入、中间和输出块。 162 | hs = [] 163 | t_emb = timestep_embedding(timesteps, unet.model_channels, repeat_only=False).to(unet.dtype) 164 | emb = unet.time_embed(t_emb) 165 | if unet.num_classes is not None: 166 | assert y.shape[0] == x.shape[0] 167 | emb = emb + unet.label_emb(y) 168 | xuh = x.type(unet.dtype) 169 | # current_step 是 cache_interval 的整数倍? 170 | step_cache_interval = current_step % cache_interval 171 | # 循环处理输入块。 172 | for id, module in enumerate(unet.input_blocks): 173 | transformer_options["block"] = ("input", id) 174 | xuh = forward_timestep_embed(module, xuh, emb, context, transformer_options) 175 | xuh = apply_control(xuh, control, 'input') 176 | if "input_block_patch" in transformer_patches: 177 | patch = transformer_patches["input_block_patch"] 178 | for p in patch: 179 | xuh = p(xuh, transformer_options) 180 | hs.append(xuh) 181 | if "input_block_patch_after_skip" in transformer_patches: 182 | patch = transformer_patches["input_block_patch_after_skip"] 183 | for p in patch: 184 | xuh = p(xuh, transformer_options) 185 | 186 | # 根据缓存策略决定是否继续处理或使用缓存。 187 | if id == cache_depth and cache_apply and input_cache: 188 | if not step_cache_interval == 0: 189 | break 190 | 191 | # 处理中间块,同样考虑缓存策略。 192 | # 如果 current_step 是 cache_interval 的整数倍 193 | # 或者 cache_apply 为 False 194 | # 或者 middle_cahce 为 False (开关关闭) 195 | # 则执行中间块的处理。 196 | if step_cache_interval == 0 or not cache_apply or not middle_cahce: 197 | transformer_options["block"] = ("middle", 0) 198 | xuh = forward_timestep_embed(unet.middle_block, xuh, emb, context, transformer_options) 199 | xuh = apply_control(xuh, control, 'middle') 200 | 201 | # 处理输出块,包括缓存的加载和使用。 202 | for id, module in enumerate(unet.output_blocks): 203 | if id < len(unet.output_blocks) - cache_depth - 1 and cache_apply and output_cache: 204 | if not step_cache_interval == 0: 205 | continue 206 | if id == len(unet.output_blocks) - cache_depth - 1 and cache_apply and output_cache: 207 | if step_cache_interval == 0: 208 | cache_h = xuh # cache 209 | else: 210 | xuh = cache_h # load cache 211 | transformer_options["block"] = ("output", id) 212 | hsp = hs.pop() 213 | hsp = apply_control(hsp, control, 'output') 214 | if "output_block_patch" in transformer_patches: 215 | patch = transformer_patches["output_block_patch"] 216 | for p in patch: 217 | xuh, hsp = p(xuh, hsp, transformer_options) 218 | xuh = th.cat([xuh, hsp], dim=1) 219 | del hsp 220 | if len(hs) > 0: 221 | output_shape = hs[-1].shape 222 | else: 223 | output_shape = None 224 | xuh = forward_timestep_embed(module, xuh, emb, context, transformer_options, output_shape) 225 | 226 | # 将输出转换回原始数据类型,并根据模型配置进行噪声消除计算。 227 | xuh = xuh.type(x.dtype) 228 | if unet.predict_codebook_ids: 229 | model_output = unet.id_predictor(xuh) 230 | else: 231 | model_output = unet.out(xuh) 232 | 233 | # 返回计算得到的最终输出。 234 | return new_model.model.model_sampling.calculate_denoised(sigma, model_output, xa) 235 | 236 | new_model.set_model_unet_function_wrapper(apply_model) 237 | 238 | return (new_model,) 239 | 240 | 241 | NODE_CLASS_MAPPINGS = { 242 | "DeepCache_Fix": DeepCache_Fix, 243 | } 244 | 245 | NODE_DISPLAY_NAME_MAPPINGS = { 246 | "DeepCache_Fix": "DeepCache_Fix", 247 | } 248 | 249 | __all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"] 250 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | 富强、民主、文明、和谐、合规 6 |
7 |
8 | 自由、平等、公正、法治、合法 9 |
10 |
11 | 爱国、敬业、诚信、友善、合理 12 |
13 | 14 | # ComfyUI-DeepCache-Fix 15 | 16 | ## 介绍 17 | 18 | For SDXL LCM,ComfyUI加速节点,生成图片时更快,同时保证了加速前后的一致性,适合大批量生图。[Accelerate ComfyUI Nodes for Faster Image Generation, Ensuring Consistency Pre and Post-Acceleration, Ideal for Bulk Image Production.] 19 | 20 | ## 用法 21 | 22 | 将该库放在 ComfyUI/custom_nodes/ 下即可。[Simply place the library in the 'ComfyUI/custom_nodes/' directory to get started.] 23 | 24 | ## 工作流例子 25 | 26 | [DeepCache-Fix.json](doc%2FDeepCache-Fix.json) 27 | 28 | ## 使用说明 29 | 30 | ### 插件参数 31 | 32 | - cache_interval: 缓存间隔, 单位: 步, 默认:3 33 | - cache_depth: 缓存深度, 默认:3 34 | - start_steps: 使用缓存的开始步数, 默认:0 35 | - end_steps: 使用缓存的结束步数, 默认:12 36 | - input_cache: 使用输入层缓存,默认:True 开启 37 | - middle_cahce: 使用中间层缓存,默认:True 开启 38 | - output_cache: 使用输出层缓存,默认:True 开启 39 | 40 | ### 举例(实践) 41 | 42 | #### 模型(蒸馏) 43 | 44 | https://www.liblib.art/modelinfo/386109978c19484298d810d6f2830780 45 | 46 | #### 生成 47 | 48 | 在总共16步的执行过程中,我们计划采取分阶段的策略。具体来说,如下 49 | 50 | 1. 0-12步(start_steps=0, end_steps=12)将利用特定的插件来执行,以提高效率和效果。 51 | 2. 从第13步开始,我们将切换回原始模型,完成剩下的4步。 (一般预留3步以上,不使用加速) 52 | 53 | 这样的安排旨在结合两者的优势,确保整个流程的顺利进行。 54 | 55 | ![img.png](doc%2Fimg.png) 56 | 57 | ## 参考 58 | 59 | 原始代码参考: https://gist.github.com/laksjdjf/435c512bc19636e9c9af4ee7bea9eb86 60 | 61 | 感谢 laksjdjf 分享的代码。 62 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | import comfy.utils 3 | except ImportError: 4 | pass 5 | else: 6 | from .DeepCache_Fix import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS 7 | __all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS'] 8 | -------------------------------------------------------------------------------- /doc/DeepCache-Fix.json: -------------------------------------------------------------------------------- 1 | { 2 | "last_node_id": 112, 3 | "last_link_id": 306, 4 | "nodes": [ 5 | { 6 | "id": 8, 7 | "type": "VAEDecode", 8 | "pos": [ 9 | 1979.6826171875, 10 | 130 11 | ], 12 | "size": { 13 | "0": 210, 14 | "1": 46 15 | }, 16 | "flags": {}, 17 | "order": 8, 18 | "mode": 0, 19 | "inputs": [ 20 | { 21 | "name": "samples", 22 | "type": "LATENT", 23 | "link": 175, 24 | "label": "Latent" 25 | }, 26 | { 27 | "name": "vae", 28 | "type": "VAE", 29 | "link": 230, 30 | "label": "VAE" 31 | } 32 | ], 33 | "outputs": [ 34 | { 35 | "name": "IMAGE", 36 | "type": "IMAGE", 37 | "links": [ 38 | 279 39 | ], 40 | "slot_index": 0, 41 | "label": "图像" 42 | } 43 | ], 44 | "properties": { 45 | "Node name for S&R": "VAEDecode" 46 | } 47 | }, 48 | { 49 | "id": 44, 50 | "type": "EmptyLatentImage", 51 | "pos": [ 52 | 649.6826171875, 53 | 130 54 | ], 55 | "size": { 56 | "0": 315, 57 | "1": 106 58 | }, 59 | "flags": {}, 60 | "order": 2, 61 | "mode": 0, 62 | "inputs": [ 63 | { 64 | "name": "width", 65 | "type": "INT", 66 | "link": 293, 67 | "widget": { 68 | "name": "width" 69 | }, 70 | "label": "宽度" 71 | }, 72 | { 73 | "name": "height", 74 | "type": "INT", 75 | "link": 294, 76 | "widget": { 77 | "name": "height" 78 | }, 79 | "label": "高度" 80 | } 81 | ], 82 | "outputs": [ 83 | { 84 | "name": "LATENT", 85 | "type": "LATENT", 86 | "links": [ 87 | 174 88 | ], 89 | "shape": 3, 90 | "label": "Latent" 91 | } 92 | ], 93 | "properties": { 94 | "Node name for S&R": "EmptyLatentImage" 95 | }, 96 | "widgets_values": [ 97 | 512, 98 | 1024, 99 | 1 100 | ] 101 | }, 102 | { 103 | "id": 92, 104 | "type": "Image Save", 105 | "pos": [ 106 | 2289.6826171875, 107 | 130 108 | ], 109 | "size": { 110 | "0": 403.4533996582031, 111 | "1": 1203.6630859375 112 | }, 113 | "flags": {}, 114 | "order": 9, 115 | "mode": 0, 116 | "inputs": [ 117 | { 118 | "name": "images", 119 | "type": "IMAGE", 120 | "link": 279 121 | } 122 | ], 123 | "outputs": [ 124 | { 125 | "name": "images", 126 | "type": "IMAGE", 127 | "links": null, 128 | "shape": 3 129 | } 130 | ], 131 | "properties": { 132 | "Node name for S&R": "Image Save" 133 | }, 134 | "widgets_values": [ 135 | "[time(%Y-%m-%d)]", 136 | "ComfyUI", 137 | "_", 138 | 4, 139 | "false", 140 | "jpg", 141 | 72, 142 | 95, 143 | "true", 144 | "false", 145 | "false", 146 | "false", 147 | "true", 148 | "true", 149 | "true" 150 | ] 151 | }, 152 | { 153 | "id": 106, 154 | "type": "CLIPTextEncodeSDXL", 155 | "pos": [ 156 | 649.6826171875, 157 | 578 158 | ], 159 | "size": { 160 | "0": 400, 161 | "1": 269.9999694824219 162 | }, 163 | "flags": { 164 | "pinned": false 165 | }, 166 | "order": 4, 167 | "mode": 0, 168 | "inputs": [ 169 | { 170 | "name": "clip", 171 | "type": "CLIP", 172 | "link": 250, 173 | "label": "CLIP" 174 | }, 175 | { 176 | "name": "target_width", 177 | "type": "INT", 178 | "link": 280, 179 | "widget": { 180 | "name": "target_width" 181 | }, 182 | "label": "目标宽度" 183 | }, 184 | { 185 | "name": "target_height", 186 | "type": "INT", 187 | "link": 281, 188 | "widget": { 189 | "name": "target_height" 190 | }, 191 | "label": "目标高度" 192 | }, 193 | { 194 | "name": "width", 195 | "type": "INT", 196 | "link": 286, 197 | "widget": { 198 | "name": "width" 199 | }, 200 | "label": "宽度" 201 | }, 202 | { 203 | "name": "height", 204 | "type": "INT", 205 | "link": 287, 206 | "widget": { 207 | "name": "height" 208 | }, 209 | "label": "高度" 210 | }, 211 | { 212 | "name": "text_g", 213 | "type": "STRING", 214 | "link": 288, 215 | "widget": { 216 | "name": "text_g" 217 | }, 218 | "label": "G文本" 219 | }, 220 | { 221 | "name": "text_l", 222 | "type": "STRING", 223 | "link": 289, 224 | "widget": { 225 | "name": "text_l" 226 | }, 227 | "label": "L文本" 228 | } 229 | ], 230 | "outputs": [ 231 | { 232 | "name": "CONDITIONING", 233 | "type": "CONDITIONING", 234 | "links": [ 235 | 296 236 | ], 237 | "shape": 3, 238 | "label": "条件", 239 | "slot_index": 0 240 | } 241 | ], 242 | "properties": { 243 | "Node name for S&R": "CLIPTextEncodeSDXL" 244 | }, 245 | "widgets_values": [ 246 | 1024, 247 | 1024, 248 | 0, 249 | 0, 250 | 1024, 251 | 1024, 252 | "", 253 | "" 254 | ] 255 | }, 256 | { 257 | "id": 104, 258 | "type": "CLIPTextEncodeSDXL", 259 | "pos": [ 260 | 649.6826171875, 261 | 977.9999694824219 262 | ], 263 | "size": { 264 | "0": 400, 265 | "1": 269.9999694824219 266 | }, 267 | "flags": { 268 | "pinned": false 269 | }, 270 | "order": 5, 271 | "mode": 0, 272 | "inputs": [ 273 | { 274 | "name": "clip", 275 | "type": "CLIP", 276 | "link": 251, 277 | "label": "CLIP" 278 | }, 279 | { 280 | "name": "target_width", 281 | "type": "INT", 282 | "link": 282, 283 | "widget": { 284 | "name": "target_width" 285 | }, 286 | "label": "目标宽度" 287 | }, 288 | { 289 | "name": "target_height", 290 | "type": "INT", 291 | "link": 283, 292 | "widget": { 293 | "name": "target_height" 294 | }, 295 | "label": "目标高度" 296 | }, 297 | { 298 | "name": "width", 299 | "type": "INT", 300 | "link": 284, 301 | "widget": { 302 | "name": "width" 303 | }, 304 | "label": "宽度" 305 | }, 306 | { 307 | "name": "height", 308 | "type": "INT", 309 | "link": 285, 310 | "widget": { 311 | "name": "height" 312 | }, 313 | "label": "高度" 314 | }, 315 | { 316 | "name": "text_g", 317 | "type": "STRING", 318 | "link": 297, 319 | "widget": { 320 | "name": "text_g" 321 | }, 322 | "label": "G文本" 323 | }, 324 | { 325 | "name": "text_l", 326 | "type": "STRING", 327 | "link": 298, 328 | "widget": { 329 | "name": "text_l" 330 | }, 331 | "label": "L文本" 332 | } 333 | ], 334 | "outputs": [ 335 | { 336 | "name": "CONDITIONING", 337 | "type": "CONDITIONING", 338 | "links": [ 339 | 295 340 | ], 341 | "shape": 3, 342 | "label": "条件", 343 | "slot_index": 0 344 | } 345 | ], 346 | "properties": { 347 | "Node name for S&R": "CLIPTextEncodeSDXL" 348 | }, 349 | "widgets_values": [ 350 | 1024, 351 | 1024, 352 | 0, 353 | 0, 354 | 1024, 355 | 1024, 356 | "", 357 | "" 358 | ] 359 | }, 360 | { 361 | "id": 110, 362 | "type": "MexxSDXLPromptStyler", 363 | "pos": [ 364 | 100, 365 | 130 366 | ], 367 | "size": { 368 | "0": 449.6826171875, 369 | "1": 793.7354125976562 370 | }, 371 | "flags": {}, 372 | "order": 0, 373 | "mode": 0, 374 | "outputs": [ 375 | { 376 | "name": "text_positive", 377 | "type": "STRING", 378 | "links": [ 379 | 288, 380 | 289 381 | ], 382 | "shape": 3, 383 | "label": "text_positive", 384 | "slot_index": 0 385 | }, 386 | { 387 | "name": "text_negative", 388 | "type": "STRING", 389 | "links": [], 390 | "shape": 3, 391 | "label": "text_negative", 392 | "slot_index": 1 393 | }, 394 | { 395 | "name": "original_text_positive", 396 | "type": "STRING", 397 | "links": null, 398 | "shape": 3, 399 | "label": "original_text_positive" 400 | }, 401 | { 402 | "name": "original_text_negative", 403 | "type": "STRING", 404 | "links": [ 405 | 297, 406 | 298 407 | ], 408 | "shape": 3, 409 | "label": "original_text_negative", 410 | "slot_index": 3 411 | }, 412 | { 413 | "name": "width", 414 | "type": "INT", 415 | "links": [ 416 | 280, 417 | 282, 418 | 284, 419 | 286, 420 | 293 421 | ], 422 | "shape": 3, 423 | "label": "width", 424 | "slot_index": 4 425 | }, 426 | { 427 | "name": "height", 428 | "type": "INT", 429 | "links": [ 430 | 281, 431 | 283, 432 | 285, 433 | 287, 434 | 294 435 | ], 436 | "shape": 3, 437 | "label": "height", 438 | "slot_index": 5 439 | } 440 | ], 441 | "properties": { 442 | "Node name for S&R": "MexxSDXLPromptStyler" 443 | }, 444 | "widgets_values": [ 445 | "girl,", 446 | "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username,blurry,artistname\n\n\n", 447 | 512, 448 | 1024, 449 | "无", 450 | "Yes" 451 | ] 452 | }, 453 | { 454 | "id": 58, 455 | "type": "CheckpointLoaderSimple", 456 | "pos": [ 457 | 100, 458 | 1053.7354125976562 459 | ], 460 | "size": { 461 | "0": 315, 462 | "1": 98 463 | }, 464 | "flags": { 465 | "collapsed": false 466 | }, 467 | "order": 1, 468 | "mode": 0, 469 | "outputs": [ 470 | { 471 | "name": "MODEL", 472 | "type": "MODEL", 473 | "links": [ 474 | 305 475 | ], 476 | "shape": 3, 477 | "label": "模型", 478 | "slot_index": 0 479 | }, 480 | { 481 | "name": "CLIP", 482 | "type": "CLIP", 483 | "links": [ 484 | 250, 485 | 251 486 | ], 487 | "shape": 3, 488 | "label": "CLIP", 489 | "slot_index": 1 490 | }, 491 | { 492 | "name": "VAE", 493 | "type": "VAE", 494 | "links": [ 495 | 230 496 | ], 497 | "shape": 3, 498 | "label": "VAE", 499 | "slot_index": 2 500 | } 501 | ], 502 | "properties": { 503 | "Node name for S&R": "CheckpointLoaderSimple" 504 | }, 505 | "widgets_values": [ 506 | "CharacterArtXLV6.safetensors" 507 | ] 508 | }, 509 | { 510 | "id": 112, 511 | "type": "LoraLoaderModelOnly", 512 | "pos": [ 513 | 649.6826171875, 514 | 366 515 | ], 516 | "size": { 517 | "0": 315, 518 | "1": 82 519 | }, 520 | "flags": {}, 521 | "order": 3, 522 | "mode": 0, 523 | "inputs": [ 524 | { 525 | "name": "model", 526 | "type": "MODEL", 527 | "link": 305, 528 | "label": "模型" 529 | } 530 | ], 531 | "outputs": [ 532 | { 533 | "name": "MODEL", 534 | "type": "MODEL", 535 | "links": [ 536 | 306 537 | ], 538 | "shape": 3, 539 | "label": "模型", 540 | "slot_index": 0 541 | } 542 | ], 543 | "properties": { 544 | "Node name for S&R": "LoraLoaderModelOnly" 545 | }, 546 | "widgets_values": [ 547 | "Hyper/Hyper-SDXL-4steps-lora.safetensors", 548 | 0.7000000000000001 549 | ] 550 | }, 551 | { 552 | "id": 108, 553 | "type": "DeepCache_Fix", 554 | "pos": [ 555 | 1149.6826171875, 556 | 130 557 | ], 558 | "size": { 559 | "0": 315, 560 | "1": 202 561 | }, 562 | "flags": {}, 563 | "order": 6, 564 | "mode": 0, 565 | "inputs": [ 566 | { 567 | "name": "model", 568 | "type": "MODEL", 569 | "link": 306, 570 | "label": "model" 571 | } 572 | ], 573 | "outputs": [ 574 | { 575 | "name": "MODEL", 576 | "type": "MODEL", 577 | "links": [ 578 | 304 579 | ], 580 | "shape": 3, 581 | "label": "MODEL", 582 | "slot_index": 0 583 | } 584 | ], 585 | "properties": { 586 | "Node name for S&R": "DeepCache_Fix" 587 | }, 588 | "widgets_values": [ 589 | 2, 590 | 3, 591 | 0, 592 | 6, 593 | "Yes", 594 | "Yes", 595 | "Yes" 596 | ] 597 | }, 598 | { 599 | "id": 3, 600 | "type": "KSampler", 601 | "pos": [ 602 | 1564.6826171875, 603 | 130 604 | ], 605 | "size": { 606 | "0": 315, 607 | "1": 262 608 | }, 609 | "flags": {}, 610 | "order": 7, 611 | "mode": 0, 612 | "inputs": [ 613 | { 614 | "name": "model", 615 | "type": "MODEL", 616 | "link": 304, 617 | "label": "模型" 618 | }, 619 | { 620 | "name": "positive", 621 | "type": "CONDITIONING", 622 | "link": 296, 623 | "label": "正面条件" 624 | }, 625 | { 626 | "name": "negative", 627 | "type": "CONDITIONING", 628 | "link": 295, 629 | "label": "负面条件" 630 | }, 631 | { 632 | "name": "latent_image", 633 | "type": "LATENT", 634 | "link": 174, 635 | "label": "Latent", 636 | "slot_index": 3 637 | } 638 | ], 639 | "outputs": [ 640 | { 641 | "name": "LATENT", 642 | "type": "LATENT", 643 | "links": [ 644 | 175 645 | ], 646 | "slot_index": 0, 647 | "label": "Latent" 648 | } 649 | ], 650 | "properties": { 651 | "Node name for S&R": "KSampler" 652 | }, 653 | "widgets_values": [ 654 | 265441529420982, 655 | "randomize", 656 | 10, 657 | 1, 658 | "euler_ancestral", 659 | "normal", 660 | 1 661 | ] 662 | } 663 | ], 664 | "links": [ 665 | [ 666 | 174, 667 | 44, 668 | 0, 669 | 3, 670 | 3, 671 | "LATENT" 672 | ], 673 | [ 674 | 175, 675 | 3, 676 | 0, 677 | 8, 678 | 0, 679 | "LATENT" 680 | ], 681 | [ 682 | 230, 683 | 58, 684 | 2, 685 | 8, 686 | 1, 687 | "VAE" 688 | ], 689 | [ 690 | 250, 691 | 58, 692 | 1, 693 | 106, 694 | 0, 695 | "CLIP" 696 | ], 697 | [ 698 | 251, 699 | 58, 700 | 1, 701 | 104, 702 | 0, 703 | "CLIP" 704 | ], 705 | [ 706 | 279, 707 | 8, 708 | 0, 709 | 92, 710 | 0, 711 | "IMAGE" 712 | ], 713 | [ 714 | 280, 715 | 110, 716 | 4, 717 | 106, 718 | 1, 719 | "INT" 720 | ], 721 | [ 722 | 281, 723 | 110, 724 | 5, 725 | 106, 726 | 2, 727 | "INT" 728 | ], 729 | [ 730 | 282, 731 | 110, 732 | 4, 733 | 104, 734 | 1, 735 | "INT" 736 | ], 737 | [ 738 | 283, 739 | 110, 740 | 5, 741 | 104, 742 | 2, 743 | "INT" 744 | ], 745 | [ 746 | 284, 747 | 110, 748 | 4, 749 | 104, 750 | 3, 751 | "INT" 752 | ], 753 | [ 754 | 285, 755 | 110, 756 | 5, 757 | 104, 758 | 4, 759 | "INT" 760 | ], 761 | [ 762 | 286, 763 | 110, 764 | 4, 765 | 106, 766 | 3, 767 | "INT" 768 | ], 769 | [ 770 | 287, 771 | 110, 772 | 5, 773 | 106, 774 | 4, 775 | "INT" 776 | ], 777 | [ 778 | 288, 779 | 110, 780 | 0, 781 | 106, 782 | 5, 783 | "STRING" 784 | ], 785 | [ 786 | 289, 787 | 110, 788 | 0, 789 | 106, 790 | 6, 791 | "STRING" 792 | ], 793 | [ 794 | 293, 795 | 110, 796 | 4, 797 | 44, 798 | 0, 799 | "INT" 800 | ], 801 | [ 802 | 294, 803 | 110, 804 | 5, 805 | 44, 806 | 1, 807 | "INT" 808 | ], 809 | [ 810 | 295, 811 | 104, 812 | 0, 813 | 3, 814 | 2, 815 | "CONDITIONING" 816 | ], 817 | [ 818 | 296, 819 | 106, 820 | 0, 821 | 3, 822 | 1, 823 | "CONDITIONING" 824 | ], 825 | [ 826 | 297, 827 | 110, 828 | 3, 829 | 104, 830 | 5, 831 | "STRING" 832 | ], 833 | [ 834 | 298, 835 | 110, 836 | 3, 837 | 104, 838 | 6, 839 | "STRING" 840 | ], 841 | [ 842 | 304, 843 | 108, 844 | 0, 845 | 3, 846 | 0, 847 | "MODEL" 848 | ], 849 | [ 850 | 305, 851 | 58, 852 | 0, 853 | 112, 854 | 0, 855 | "MODEL" 856 | ], 857 | [ 858 | 306, 859 | 112, 860 | 0, 861 | 108, 862 | 0, 863 | "MODEL" 864 | ] 865 | ], 866 | "groups": [], 867 | "config": {}, 868 | "extra": { 869 | "groupNodes": {}, 870 | "ds": { 871 | "scale": 0.7627768444385479, 872 | "offset": [ 873 | -338.05732108505117, 874 | -133.4402185526674 875 | ] 876 | } 877 | }, 878 | "version": 0.4 879 | } -------------------------------------------------------------------------------- /doc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftMeng/ComfyUI-DeepCache-Fix/03402ce472259f38681c83c73e05f75d49f5266e/doc/icon.png -------------------------------------------------------------------------------- /doc/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SoftMeng/ComfyUI-DeepCache-Fix/03402ce472259f38681c83c73e05f75d49f5266e/doc/img.png --------------------------------------------------------------------------------