ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

Dynamic VRAM: a LoRA patch on a module without comfy_cast_weights is silently dropped (Qwen-Image 2.1 txt_in.text_norm)

Open DustyL opened this issue 3 weeks ago • 1 comments

Custom Node Testing

  • [x] I have tried disabling custom nodes and the issue persists (every run below used --disable-all-custom-nodes)

Expected Behavior

A LoRA / model patch (diff or set) on a model weight is applied the same way with dynamic VRAM on and off, or a message says that it could not be applied.

Actual Behavior

With dynamic VRAM on (the default), a patch on a parameter of a module that has no comfy_cast_weights attribute is never applied, and nothing is logged. The load line even reports 0 patches attached. With --disable-dynamic-vram the same patch is applied.

Qwen-Image 2.1 has such a module: txt_in.text_norm is ZeroCenteredRMSNorm, a plain nn.Module with an nn.Parameter (comfy/ldm/qwen_image21/model.py L21-36). A patch on a neighbouring cast module (txt_in.in_layer, a comfy ops Linear) is applied in both modes, so this is specific to the non-cast path.

Same workflow and seed, 1024x1024, 20 steps. Each number compares a render with one patch against the render with no patch, in the same mode (mean absolute pixel difference on 0-255, and the share of pixels that changed):

Patch dynamic VRAM (default) --disable-dynamic-vram
txt_in.text_norm (no comfy_cast_weights) 0.000, 0.00 % of pixels: identical image 47.8, 99.98 %
txt_in.in_layer (cast module, control) 2.16, 98.6 % 1.88, 98.5 %

The two no-patch renders (dynamic against static) are pixel-identical, so the modes differ only in the patch.

The log of the dynamic run says the same thing: Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 0 patches attached. for the text_norm patch, and 1 patches attached for the in_layer patch.

Steps to Reproduce

  1. ComfyUI 0.45.0, started with --disable-all-custom-nodes. Models: qwen_image_2.1_bf16.safetensors, qwen3vl_8b_bf16.safetensors, qwen_image_2.1_vae_bf16.safetensors.
  2. Make two one-tensor patch files:
import torch
from safetensors.torch import save_file
# txt_in.text_norm: plain nn.Module, no comfy_cast_weights. txt_in.in_layer: comfy ops Linear (control).
save_file({"diffusion_model.txt_in.text_norm.diff": torch.ones(4096)}, "models/loras/repro/text_norm_diff.safetensors")
save_file({"diffusion_model.txt_in.in_layer.diff": torch.full((4096, 4096), 0.01)}, "models/loras/repro/in_layer_diff.safetensors")
  1. Queue the workflow below three times with the same seed: once without the LoraLoaderModelOnly node (model wired straight from UNETLoader), once with repro/text_norm_diff.safetensors, once with repro/in_layer_diff.safetensors. Compare each patched image with the unpatched one.
  2. Restart with --disable-all-custom-nodes --disable-dynamic-vram and repeat.
Workflow (API format, core nodes only; shown with the text_norm patch)
{
 "1": {
  "class_type": "UNETLoader",
  "inputs": {
   "unet_name": "diffusion_models/qwen_image_2.1_bf16.safetensors",
   "weight_dtype": "default"
  }
 },
 "2": {
  "class_type": "CLIPLoader",
  "inputs": {
   "clip_name": "text_encoders/qwen3vl_8b_bf16.safetensors",
   "type": "qwen_image",
   "device": "default"
  }
 },
 "3": {
  "class_type": "VAELoader",
  "inputs": {
   "vae_name": "Qwen-Image-2.1/qwen_image_2.1_vae_bf16.safetensors"
  }
 },
 "5": {
  "class_type": "TextEncodeQwenImage21",
  "inputs": {
   "clip": [
    "2",
    0
   ],
   "prompt": "a red apple on a wooden table, studio light",
   "negative_prompt": "",
   "resolution": 1024
  }
 },
 "6": {
  "class_type": "EmptyLatentImage",
  "inputs": {
   "width": 1024,
   "height": 1024,
   "batch_size": 1
  }
 },
 "4": {
  "class_type": "LoraLoaderModelOnly",
  "inputs": {
   "model": [
    "1",
    0
   ],
   "lora_name": "repro/text_norm_diff.safetensors",
   "strength_model": 1.0
  }
 },
 "7": {
  "class_type": "QwenImage21Cache",
  "inputs": {
   "model": [
    "4",
    0
   ],
   "device": "auto",
   "dtype": "default"
  }
 },
 "10": {
  "class_type": "KSampler",
  "inputs": {
   "model": [
    "7",
    0
   ],
   "positive": [
    "5",
    0
   ],
   "negative": [
    "5",
    1
   ],
   "latent_image": [
    "6",
    0
   ],
   "seed": 42,
   "steps": 20,
   "cfg": 1.0,
   "sampler_name": "euler",
   "scheduler": "simple",
   "denoise": 1.0
  }
 },
 "20": {
  "class_type": "VAEDecode",
  "inputs": {
   "samples": [
    "10",
    0
   ],
   "vae": [
    "3",
    0
   ]
  }
 },
 "21": {
  "class_type": "SaveImage",
  "inputs": {
   "images": [
    "20",
    0
   ],
   "filename_prefix": "repro_textnorm"
  }
 }
}

Where it happens. comfy/model_patcher.py, ModelPatcherDynamic.load, at v0.45.0 (the class is unchanged on master b2f6707). For a module with comfy_cast_weights, patches are either attached as a LowVramPatch (setup_param) or applied by force_load_param, which calls self.patch_weight_to_device(key, device_to=device_to, force_cast=True) (L2049-2059). For a module without it, the else: branch (L2094-2103) only backs up each parameter, casts it with weight.to(dtype=model_dtype, device=device_to) and sets it. patch_weight_to_device is never called there, so an entry in self.patches for that key has no effect.

Debug Logs

Home directory shortened to ~ and the output folder shortened to ~/repro; nothing else changed.

Dynamic VRAM (default), three prompts: no patch, text_norm patch, in_layer patch.

[INFO] setup plugin alembic.autogenerate.schemas
[INFO] setup plugin alembic.autogenerate.tables
[INFO] setup plugin alembic.autogenerate.types
[INFO] setup plugin alembic.autogenerate.constraints
[INFO] setup plugin alembic.autogenerate.defaults
[INFO] setup plugin alembic.autogenerate.comments
[INFO] setup plugin alembic.ext.checkconstraint_byname
[INFO] Adding extra search path checkpoints ~/SwarmUI/Models/Stable-Diffusion
[INFO] Adding extra search path diffusion_models ~/SwarmUI/Models/diffusion_models
[INFO] Adding extra search path diffusion_models ~/SwarmUI/Models/unet
[INFO] Adding extra search path loras ~/SwarmUI/Models/Lora
[INFO] Adding extra search path vae ~/SwarmUI/Models/VAE
[INFO] Adding extra search path text_encoders ~/SwarmUI/Models/text_encoders
[INFO] Adding extra search path text_encoders ~/SwarmUI/Models/clip
[INFO] Adding extra search path clip ~/SwarmUI/Models/clip
[INFO] Adding extra search path clip ~/SwarmUI/Models/text_encoders
[INFO] Adding extra search path clip_vision ~/SwarmUI/Models/clip_vision
[INFO] Adding extra search path controlnet ~/SwarmUI/Models/controlnet
[INFO] Adding extra search path style_models ~/SwarmUI/Models/style_models
[INFO] Adding extra search path upscale_models ~/SwarmUI/Models/upscale_models
[INFO] Adding extra search path latent_upscale_models ~/SwarmUI/Models/latent_upscale_models
[INFO] Adding extra search path embeddings ~/SwarmUI/Models/Embeddings
[INFO] Adding extra search path model_patches ~/SwarmUI/Models/model_patches
[INFO] Setting output directory to: ~/repro/run2_dynamic
[INFO] Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'int8_linear', 'na3d', 'quantize_and_rotate_rowwise', 'quantize_int8_rowwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'w4a8_int8_linear']}
[INFO] Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'closest_hit_on_mesh', 'closest_point_on_mesh', 'connected_components', 'convrot_w4a4_linear', 'delaunay3d', 'dequantize_convrot_w4a4_weight', 'dequantize_int8_convrot_weight', 'dequantize_int8_convrot_weight_dtype', 'dequantize_int8_simple', 'dequantize_int8_simple_dtype', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'dequantize_w4a8_int8_weight', 'edge_collapse_checks', 'fp16_conv3d', 'fp16_conv3d_out', 'fp16_linear', 'gemv_awq_w4a16', 'group_norm_silu_pad3d', 'group_norm_silu_pad3d_out', 'group_norm_stats3d', 'int8_linear', 'mesh_bvh', 'min_cut', 'na3d', 'prepare_int4_weight_for_int8_linear', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'quantize_w4a8_int8_weight', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'rotate_int8_convrot_weight', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'sol_attn', 'stochastic_rounding_fp8', 'w4a8_int8_linear', 'w4a8_packed_linear', 'window_attention']}
[INFO] Found comfy_kitchen backend ascend: {'available': False, 'disabled': False, 'unavailable_reason': "torch-npu is not installed: No module named 'torch_npu'", 'capabilities': []}
[INFO] Found comfy_kitchen backend hip: {'available': False, 'disabled': False, 'unavailable_reason': 'PyTorch ROCm/HIP runtime not available', 'capabilities': []}
[INFO] Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'convrot_w4a4_linear', 'dequantize_convrot_w4a4_weight', 'dequantize_int8_convrot_weight', 'dequantize_int8_convrot_weight_dtype', 'dequantize_int8_embedding', 'dequantize_int8_simple', 'dequantize_int8_simple_dtype', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'dequantize_w4a8_int8_weight', 'fp16_conv3d', 'fp16_conv3d_out', 'fp16_linear', 'gemv_awq_w4a16', 'group_norm_silu_pad3d', 'group_norm_silu_pad3d_out', 'group_norm_stats3d', 'int8_linear', 'int8_linear_modulated', 'int8_linear_rms_modulated', 'na3d', 'prepare_int4_weight_for_int8_linear', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'quantize_w4a8_int8_weight', 'rms_adaln', 'rms_gated_residual', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'rotate_int8_convrot_weight', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'sol_attn', 'stochastic_rounding_fp8', 'w4a8_int8_linear', 'w4a8_packed_linear', 'window_attention']}
[INFO] Checkpoint files will always be loaded safely.
[INFO] Total VRAM 32168 MB, total RAM 124002 MB
[INFO] pytorch version: 2.16.0a0+gitd457273
[INFO] Set vram state to: NORMAL_VRAM
[INFO] Device: cuda:0 NVIDIA GeForce RTX 5090 : native
[INFO] Using async weight offloading with 2 streams
[INFO] Enabled pinned memory 111601.0
[INFO] Using pytorch attention
[INFO] aimdo: /project/src/control.c:283:INFO:comfy-aimdo inited for GPU: NVIDIA GeForce RTX 5090 (VRAM: 32168 MB)
[INFO] DynamicVRAM support detected and enabled
[INFO] Python version: 3.14.10 (main, Oct 26 2026, 14:09:22) [Clang 23.1.3 ]
[INFO] ComfyUI version: 0.45.0
[INFO] comfy-aimdo version: 0.6.0
[INFO] comfy-kitchen version: 0.2.41
[INFO] comfyui-frontend-package version: 1.61.0.dev1
[INFO] comfyui-workflow-templates version: 0.11.106
[INFO] comfyui-embedded-docs version: 0.5.16
[INFO] comfy-aimdo version: 0.6.0
[INFO] comfy-kitchen version: 0.2.41
[INFO] [Prompt Server] web root: ~/ComfyUI/venv/lib/python3.14/site-packages/comfyui_frontend_package/static
[INFO] Asset seeder disabled
[INFO] No OpenGL_accelerate module loaded: Acceleration disabled
[INFO] Skipping loading of custom nodes
[INFO] Using RAM pressure cache.
[INFO] ComfyUI is developed by Comfy Org. We also offer commercial products to deploy ComfyUI as scalable cloud endpoints. Visit platform.comfy.org/ascii for more information.
[INFO] Starting server

[INFO] To see the GUI go to: http://127.0.0.1:8190
[INFO] got prompt
[INFO] Model storage policy: fast_disk=True paths=['~/SwarmUI/Models/VAE/Qwen-Image-2.1/qwen_image_2.1_vae_bf16.safetensors']
[INFO] Using pytorch attention in VAE
[INFO] Using pytorch attention in VAE
[INFO] VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
[INFO] Model storage policy: fast_disk=True paths=['~/SwarmUI/Models/clip/text_encoders/qwen3vl_8b_bf16.safetensors']
[INFO] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[INFO] Requested to load QwenImage21TEModel_
[INFO] Model QwenImage21TEModel_ prepared for dynamic VRAM loading. 16721MB Staged. 0 patches attached. Force pre-loaded 255 weights: 849 KB.
[INFO] Model QwenImage21TEModel_ prepared for dynamic VRAM loading. 16721MB Staged. 0 patches attached. Force pre-loaded 255 weights: 849 KB.
[INFO] model weight dtype torch.bfloat16, manual cast: None
[INFO] model_type FLUX
[INFO] Model storage policy: fast_disk=True paths=['~/SwarmUI/Models/diffusion_models/diffusion_models/qwen_image_2.1_bf16.safetensors']
[INFO] Requested to load QwenImage21
[INFO] Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 0 patches attached. Force pre-loaded 65 weights: 63 KB.
[INFO] Requested to load KVCacheModel
[INFO] Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 0 patches attached. Force pre-loaded 65 weights: 63 KB.
[INFO] Model KVCacheModel prepared for dynamic VRAM loading. 13MB Staged. 0 patches attached.

  0%|          | 0/20 [00:00<?, ?it/s]
  0%|          | 0/20 [00:00<?, ?it/s,   Model Initializing ...  ]
  0%|          | 0/20 [00:01<?, ?it/s,  Model Initialization complete!  ]
  5%|▌         | 1/20 [00:01<00:22,  1.19s/it,  Model Initialization complete!  ]
  5%|▌         | 1/20 [00:00<00:22,  1.19s/it]
 15%|█▌        | 3/20 [00:00<00:02,  5.99it/s]
 20%|██        | 4/20 [00:00<00:04,  3.21it/s]
 25%|██▌       | 5/20 [00:01<00:04,  3.20it/s]
 30%|███       | 6/20 [00:01<00:04,  3.21it/s]
 35%|███▌      | 7/20 [00:01<00:04,  3.21it/s]
 40%|████      | 8/20 [00:02<00:03,  3.20it/s]
 45%|████▌     | 9/20 [00:02<00:03,  3.21it/s]
 50%|█████     | 10/20 [00:02<00:03,  3.20it/s]
 55%|█████▌    | 11/20 [00:03<00:02,  3.20it/s]
 60%|██████    | 12/20 [00:03<00:02,  3.20it/s]
 65%|██████▌   | 13/20 [00:03<00:02,  3.21it/s]
 70%|███████   | 14/20 [00:04<00:01,  3.20it/s]
 75%|███████▌  | 15/20 [00:04<00:01,  3.20it/s]
 80%|████████  | 16/20 [00:04<00:01,  3.21it/s]
 85%|████████▌ | 17/20 [00:05<00:00,  3.20it/s]
 90%|█████████ | 18/20 [00:05<00:00,  3.20it/s]
 95%|█████████▌| 19/20 [00:05<00:00,  3.20it/s]
100%|██████████| 20/20 [00:05<00:00,  3.21it/s]
100%|██████████| 20/20 [00:05<00:00,  3.35it/s]
[INFO] Comfy model compiler graph breaks: 0, rogues: 0
[INFO] Requested to load WanVAE
[INFO] Model WanVAE prepared for dynamic VRAM loading. 644MB Staged. 0 patches attached. Force pre-loaded 68 weights: 102 KB.
[INFO] Prompt executed in 9.72 seconds
[INFO] got prompt
[INFO] Requested to load QwenImage21
[INFO] Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 0 patches attached. Force pre-loaded 65 weights: 63 KB.
[INFO] Requested to load KVCacheModel
[INFO] Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 0 patches attached. Force pre-loaded 65 weights: 63 KB.
[INFO] Model KVCacheModel prepared for dynamic VRAM loading. 13MB Staged. 0 patches attached.

  0%|          | 0/20 [00:00<?, ?it/s]
  0%|          | 0/20 [00:00<?, ?it/s,   Model Initializing ...  ]
  0%|          | 0/20 [00:00<?, ?it/s,  Model Initialization complete!  ]
  5%|▌         | 1/20 [00:00<00:17,  1.08it/s,  Model Initialization complete!  ]
  5%|▌         | 1/20 [00:00<00:17,  1.08it/s]
 15%|█▌        | 3/20 [00:00<00:02,  6.00it/s]
 20%|██        | 4/20 [00:00<00:04,  3.21it/s]
 25%|██▌       | 5/20 [00:01<00:04,  3.20it/s]
 30%|███       | 6/20 [00:01<00:04,  3.19it/s]
 35%|███▌      | 7/20 [00:01<00:04,  3.21it/s]
 40%|████      | 8/20 [00:02<00:03,  3.18it/s]
 45%|████▌     | 9/20 [00:02<00:03,  3.16it/s]
 50%|█████     | 10/20 [00:02<00:03,  3.18it/s]
 55%|█████▌    | 11/20 [00:03<00:02,  3.21it/s]
 60%|██████    | 12/20 [00:03<00:02,  3.19it/s]
 65%|██████▌   | 13/20 [00:03<00:02,  3.20it/s]
 70%|███████   | 14/20 [00:04<00:01,  3.21it/s]
 75%|███████▌  | 15/20 [00:04<00:01,  3.19it/s]
 80%|████████  | 16/20 [00:04<00:01,  3.18it/s]
 85%|████████▌ | 17/20 [00:05<00:00,  3.21it/s]
 90%|█████████ | 18/20 [00:05<00:00,  3.20it/s]
 95%|█████████▌| 19/20 [00:05<00:00,  3.20it/s]
100%|██████████| 20/20 [00:05<00:00,  3.21it/s]
100%|██████████| 20/20 [00:05<00:00,  3.34it/s]
[INFO] Comfy model compiler graph breaks: 0, rogues: 0
[INFO] Model WanVAE prepared for dynamic VRAM loading. 644MB Staged. 0 patches attached. Force pre-loaded 68 weights: 102 KB.
[INFO] Prompt executed in 7.23 seconds
[INFO] got prompt
[INFO] Requested to load QwenImage21
[INFO] Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 1 patches attached. Force pre-loaded 65 weights: 63 KB.
[INFO] Requested to load KVCacheModel
[INFO] Model QwenImage21 prepared for dynamic VRAM loading. 13571MB Staged. 1 patches attached. Force pre-loaded 65 weights: 63 KB.
[INFO] Model KVCacheModel prepared for dynamic VRAM loading. 13MB Staged. 0 patches attached.

  0%|          | 0/20 [00:00<?, ?it/s]
  0%|          | 0/20 [00:00<?, ?it/s,   Model Initializing ...  ]
  0%|          | 0/20 [00:00<?, ?it/s,  Model Initialization complete!  ]
  5%|▌         | 1/20 [00:00<00:17,  1.08it/s,  Model Initialization complete!  ]
  5%|▌         | 1/20 [00:00<00:17,  1.08it/s]
 15%|█▌        | 3/20 [00:00<00:02,  6.00it/s]
 20%|██        | 4/20 [00:00<00:05,  3.20it/s]
 25%|██▌       | 5/20 [00:01<00:04,  3.17it/s]
 30%|███       | 6/20 [00:01<00:04,  3.17it/s]
 35%|███▌      | 7/20 [00:01<00:04,  3.20it/s]
 40%|████      | 8/20 [00:02<00:03,  3.19it/s]
 45%|████▌     | 9/20 [00:02<00:03,  3.20it/s]
 50%|█████     | 10/20 [00:02<00:03,  3.19it/s]
 55%|█████▌    | 11/20 [00:03<00:02,  3.19it/s]
 60%|██████    | 12/20 [00:03<00:02,  3.17it/s]
 65%|██████▌   | 13/20 [00:03<00:02,  3.17it/s]
 70%|███████   | 14/20 [00:04<00:01,  3.18it/s]
 75%|███████▌  | 15/20 [00:04<00:01,  3.16it/s]
 80%|████████  | 16/20 [00:04<00:01,  3.18it/s]
 85%|████████▌ | 17/20 [00:05<00:00,  3.17it/s]
 90%|█████████ | 18/20 [00:05<00:00,  3.18it/s]
 95%|█████████▌| 19/20 [00:05<00:00,  3.20it/s]
100%|██████████| 20/20 [00:06<00:00,  3.21it/s]
100%|██████████| 20/20 [00:06<00:00,  3.33it/s]
[INFO] Comfy model compiler graph breaks: 0, rogues: 0
[INFO] Model WanVAE prepared for dynamic VRAM loading. 644MB Staged. 0 patches attached. Force pre-loaded 68 weights: 102 KB.
[INFO] Prompt executed in 7.25 seconds
~/.local/share/uv/python/cpython-3.14.10-linux-x86_64-gnu/lib/python3.14/multiprocessing/resource_tracker.py:475: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown: {'/mp-88cvtexl'}
  warnings.warn(
Same three prompts with --disable-dynamic-vram
[INFO] setup plugin alembic.autogenerate.schemas
[INFO] setup plugin alembic.autogenerate.tables
[INFO] setup plugin alembic.autogenerate.types
[INFO] setup plugin alembic.autogenerate.constraints
[INFO] setup plugin alembic.autogenerate.defaults
[INFO] setup plugin alembic.autogenerate.comments
[INFO] setup plugin alembic.ext.checkconstraint_byname
[INFO] Adding extra search path checkpoints ~/SwarmUI/Models/Stable-Diffusion
[INFO] Adding extra search path diffusion_models ~/SwarmUI/Models/diffusion_models
[INFO] Adding extra search path diffusion_models ~/SwarmUI/Models/unet
[INFO] Adding extra search path loras ~/SwarmUI/Models/Lora
[INFO] Adding extra search path vae ~/SwarmUI/Models/VAE
[INFO] Adding extra search path text_encoders ~/SwarmUI/Models/text_encoders
[INFO] Adding extra search path text_encoders ~/SwarmUI/Models/clip
[INFO] Adding extra search path clip ~/SwarmUI/Models/clip
[INFO] Adding extra search path clip ~/SwarmUI/Models/text_encoders
[INFO] Adding extra search path clip_vision ~/SwarmUI/Models/clip_vision
[INFO] Adding extra search path controlnet ~/SwarmUI/Models/controlnet
[INFO] Adding extra search path style_models ~/SwarmUI/Models/style_models
[INFO] Adding extra search path upscale_models ~/SwarmUI/Models/upscale_models
[INFO] Adding extra search path latent_upscale_models ~/SwarmUI/Models/latent_upscale_models
[INFO] Adding extra search path embeddings ~/SwarmUI/Models/Embeddings
[INFO] Adding extra search path model_patches ~/SwarmUI/Models/model_patches
[INFO] Setting output directory to: ~/repro/run2_static
[INFO] Found comfy_kitchen backend cuda: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'closest_hit_on_mesh', 'closest_point_on_mesh', 'connected_components', 'convrot_w4a4_linear', 'delaunay3d', 'dequantize_convrot_w4a4_weight', 'dequantize_int8_convrot_weight', 'dequantize_int8_convrot_weight_dtype', 'dequantize_int8_simple', 'dequantize_int8_simple_dtype', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'dequantize_w4a8_int8_weight', 'edge_collapse_checks', 'fp16_conv3d', 'fp16_conv3d_out', 'fp16_linear', 'gemv_awq_w4a16', 'group_norm_silu_pad3d', 'group_norm_silu_pad3d_out', 'group_norm_stats3d', 'int8_linear', 'mesh_bvh', 'min_cut', 'na3d', 'prepare_int4_weight_for_int8_linear', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'quantize_w4a8_int8_weight', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'rotate_int8_convrot_weight', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'sol_attn', 'stochastic_rounding_fp8', 'w4a8_int8_linear', 'w4a8_packed_linear', 'window_attention']}
[INFO] Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'int8_linear', 'na3d', 'quantize_and_rotate_rowwise', 'quantize_int8_rowwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'rms_adaln', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'w4a8_int8_linear']}
[INFO] Found comfy_kitchen backend hip: {'available': False, 'disabled': False, 'unavailable_reason': 'PyTorch ROCm/HIP runtime not available', 'capabilities': []}
[INFO] Found comfy_kitchen backend ascend: {'available': False, 'disabled': False, 'unavailable_reason': "torch-npu is not installed: No module named 'torch_npu'", 'capabilities': []}
[INFO] Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['adaln', 'apply_rope', 'apply_rope1', 'apply_rope1_', 'apply_rope_', 'apply_rope_split_half', 'apply_rope_split_half1', 'apply_rope_split_half1_', 'apply_rope_split_half_', 'convrot_w4a4_linear', 'dequantize_convrot_w4a4_weight', 'dequantize_int8_convrot_weight', 'dequantize_int8_convrot_weight_dtype', 'dequantize_int8_embedding', 'dequantize_int8_simple', 'dequantize_int8_simple_dtype', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'dequantize_w4a8_int8_weight', 'fp16_conv3d', 'fp16_conv3d_out', 'fp16_linear', 'gemv_awq_w4a16', 'group_norm_silu_pad3d', 'group_norm_silu_pad3d_out', 'group_norm_stats3d', 'int8_linear', 'int8_linear_modulated', 'int8_linear_rms_modulated', 'na3d', 'prepare_int4_weight_for_int8_linear', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'quantize_svdquant_w4a4', 'quantize_w4a8_int8_weight', 'rms_adaln', 'rms_gated_residual', 'rms_rope', 'rms_rope1', 'rms_rope1_', 'rms_rope_', 'rms_rope_split_half', 'rms_rope_split_half1', 'rms_rope_split_half1_', 'rms_rope_split_half_', 'rotate_int8_convrot_weight', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4', 'scaled_mm_svdquant_w4a4', 'sol_attn', 'stochastic_rounding_fp8', 'w4a8_int8_linear', 'w4a8_packed_linear', 'window_attention']}
[INFO] Checkpoint files will always be loaded safely.
[INFO] Total VRAM 32168 MB, total RAM 124002 MB
[INFO] pytorch version: 2.16.0a0+gitd457273
[INFO] Set vram state to: NORMAL_VRAM
[INFO] Device: cuda:0 NVIDIA GeForce RTX 5090 : native
[INFO] Using async weight offloading with 2 streams
[INFO] Enabled pinned memory 111601.0
[INFO] Using pytorch attention
[INFO] Python version: 3.14.10 (main, Oct 26 2026, 14:09:22) [Clang 23.1.3 ]
[INFO] ComfyUI version: 0.45.0
[INFO] comfy-aimdo version: 0.6.0
[INFO] comfy-kitchen version: 0.2.41
[WARNING] Dynamic vram disabled with argument. If you have any issues with dynamic vram enabled please give us a detailed reports as this argument will be removed soon. If you use gguf we recommend keeping dynamic vram enabled and using native ComfyUI model formats instead. ComfyUI native formats like fp8, int8 and w4a8 will be faster even if they are larger than your memory.
[INFO] comfyui-frontend-package version: 1.61.0.dev1
[INFO] comfyui-workflow-templates version: 0.11.106
[INFO] comfyui-embedded-docs version: 0.5.16
[INFO] comfy-aimdo version: 0.6.0
[INFO] comfy-kitchen version: 0.2.41
[INFO] [Prompt Server] web root: ~/ComfyUI/venv/lib/python3.14/site-packages/comfyui_frontend_package/static
[INFO] Asset seeder disabled
[INFO] No OpenGL_accelerate module loaded: Acceleration disabled
[INFO] Skipping loading of custom nodes
[INFO] Using RAM pressure cache.
[INFO] ComfyUI is developed by Comfy Org. We also offer commercial products to deploy ComfyUI as scalable cloud endpoints. Visit platform.comfy.org/ascii for more information.
[INFO] Starting server

[INFO] To see the GUI go to: http://127.0.0.1:8190
[INFO] got prompt
[INFO] Model storage policy: fast_disk=True paths=['~/SwarmUI/Models/VAE/Qwen-Image-2.1/qwen_image_2.1_vae_bf16.safetensors']
[INFO] Using pytorch attention in VAE
[INFO] Using pytorch attention in VAE
[INFO] VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
[INFO] Model storage policy: fast_disk=True paths=['~/SwarmUI/Models/clip/text_encoders/qwen3vl_8b_bf16.safetensors']
[INFO] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[INFO] Requested to load QwenImage21TEModel_
[INFO] loaded completely; 29733.55 MB usable, 16721.96 MB loaded, full load: True
[INFO] model weight dtype torch.bfloat16, manual cast: None
[INFO] model_type FLUX
[INFO] Model storage policy: fast_disk=True paths=['~/SwarmUI/Models/diffusion_models/diffusion_models/qwen_image_2.1_bf16.safetensors']
[INFO] Requested to load QwenImage21
[INFO] Unloaded partially: 2457.89 MB freed, 14264.07 MB remains loaded, 160.00 MB buffer reserved, lowvram patches: 0
[INFO] loaded completely; 15269.48 MB usable, 13571.02 MB loaded, full load: True

  0%|          | 0/20 [00:00<?, ?it/s]
  5%|▌         | 1/20 [00:00<00:08,  2.30it/s]
 15%|█▌        | 3/20 [00:00<00:03,  4.30it/s]
 20%|██        | 4/20 [00:01<00:04,  3.83it/s]
 25%|██▌       | 5/20 [00:01<00:04,  3.60it/s]
 30%|███       | 6/20 [00:01<00:04,  3.46it/s]
 35%|███▌      | 7/20 [00:02<00:03,  3.38it/s]
 40%|████      | 8/20 [00:02<00:03,  3.32it/s]
 45%|████▌     | 9/20 [00:02<00:03,  3.28it/s]
 50%|█████     | 10/20 [00:02<00:03,  3.26it/s]
 55%|█████▌    | 11/20 [00:03<00:02,  3.24it/s]
 60%|██████    | 12/20 [00:03<00:02,  3.23it/s]
 65%|██████▌   | 13/20 [00:03<00:02,  3.22it/s]
 70%|███████   | 14/20 [00:04<00:01,  3.22it/s]
 75%|███████▌  | 15/20 [00:04<00:01,  3.20it/s]
 80%|████████  | 16/20 [00:04<00:01,  3.20it/s]
 85%|████████▌ | 17/20 [00:05<00:00,  3.19it/s]
 90%|█████████ | 18/20 [00:05<00:00,  3.19it/s]
 95%|█████████▌| 19/20 [00:05<00:00,  3.19it/s]
100%|██████████| 20/20 [00:06<00:00,  3.19it/s]
100%|██████████| 20/20 [00:06<00:00,  3.29it/s]
[INFO] Requested to load WanVAE
[INFO] loaded completely; 715.60 MB usable, 644.19 MB loaded, full load: True
[INFO] Prompt executed in 12.63 seconds
[INFO] got prompt
[INFO] Requested to load QwenImage21
[INFO] loaded completely; 14610.68 MB usable, 13571.02 MB loaded, full load: True

  0%|          | 0/20 [00:00<?, ?it/s]
  5%|▌         | 1/20 [00:00<00:02,  8.75it/s]
 10%|█         | 2/20 [00:00<00:03,  5.63it/s]
 15%|█▌        | 3/20 [00:00<00:04,  4.19it/s]
 20%|██        | 4/20 [00:00<00:04,  3.74it/s]
 25%|██▌       | 5/20 [00:01<00:04,  3.53it/s]
 30%|███       | 6/20 [00:01<00:04,  3.41it/s]
 35%|███▌      | 7/20 [00:01<00:03,  3.33it/s]
 40%|████      | 8/20 [00:02<00:03,  3.28it/s]
 45%|████▌     | 9/20 [00:02<00:03,  3.25it/s]
 50%|█████     | 10/20 [00:02<00:03,  3.23it/s]
 55%|█████▌    | 11/20 [00:03<00:02,  3.22it/s]
 60%|██████    | 12/20 [00:03<00:02,  3.22it/s]
 65%|██████▌   | 13/20 [00:03<00:02,  3.21it/s]
 70%|███████   | 14/20 [00:04<00:01,  3.20it/s]
 75%|███████▌  | 15/20 [00:04<00:01,  3.20it/s]
 80%|████████  | 16/20 [00:04<00:01,  3.19it/s]
 85%|████████▌ | 17/20 [00:05<00:00,  3.19it/s]
 90%|█████████ | 18/20 [00:05<00:00,  3.19it/s]
 95%|█████████▌| 19/20 [00:05<00:00,  3.19it/s]
100%|██████████| 20/20 [00:05<00:00,  3.19it/s]
100%|██████████| 20/20 [00:05<00:00,  3.35it/s]
[INFO] Prompt executed in 10.02 seconds
[INFO] got prompt
[INFO] Requested to load QwenImage21
[INFO] loaded completely; 14610.68 MB usable, 13571.02 MB loaded, full load: True

  0%|          | 0/20 [00:00<?, ?it/s]
  5%|▌         | 1/20 [00:00<00:02,  8.75it/s]
 10%|█         | 2/20 [00:00<00:03,  5.63it/s]
 15%|█▌        | 3/20 [00:00<00:04,  4.18it/s]
 20%|██        | 4/20 [00:00<00:04,  3.74it/s]
 25%|██▌       | 5/20 [00:01<00:04,  3.52it/s]
 30%|███       | 6/20 [00:01<00:04,  3.41it/s]
 35%|███▌      | 7/20 [00:01<00:03,  3.34it/s]
 40%|████      | 8/20 [00:02<00:03,  3.30it/s]
 45%|████▌     | 9/20 [00:02<00:03,  3.26it/s]
 50%|█████     | 10/20 [00:02<00:03,  3.24it/s]
 55%|█████▌    | 11/20 [00:03<00:02,  3.23it/s]
 60%|██████    | 12/20 [00:03<00:02,  3.22it/s]
 65%|██████▌   | 13/20 [00:03<00:02,  3.21it/s]
 70%|███████   | 14/20 [00:04<00:01,  3.20it/s]
 75%|███████▌  | 15/20 [00:04<00:01,  3.20it/s]
 80%|████████  | 16/20 [00:04<00:01,  3.20it/s]
 85%|████████▌ | 17/20 [00:05<00:00,  3.20it/s]
 90%|█████████ | 18/20 [00:05<00:00,  3.19it/s]
 95%|█████████▌| 19/20 [00:05<00:00,  3.19it/s]
100%|██████████| 20/20 [00:05<00:00,  3.19it/s]
100%|██████████| 20/20 [00:05<00:00,  3.35it/s]
[INFO] Prompt executed in 10.04 seconds
~/.local/share/uv/python/cpython-3.14.10-linux-x86_64-gnu/lib/python3.14/multiprocessing/resource_tracker.py:475: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown: {'/mp-m6351iwl'}
  warnings.warn(

Other

  • Related but different: #17690 (the dtype of the LoRA sum in the dynamic path) and #17548 / #17549 (the static patcher's load transitions).
  • Linux, RTX 5090 (32 GB), Python 3.14, PyTorch 2.16.0a0 (built from source), comfy-aimdo 0.6.0.
  • A LoRA or model-merge file that carries a weight for txt_in.text_norm loses that part silently under dynamic VRAM. The same should hold for any other parameter that lives on a plain nn.Module.
  • Prepared with the help of an AI coding assistant. The reproduction was run on my machine and the logs above are from those runs.

DustyL avatar Nov 11 '26 23:11 DustyL

I'd like to take this — planning to trace the dynamic VRAM patch-attachment path (the log line says the patch is dropped at preparation, so the module enumeration that skips non-comfy_cast_weights modules should be findable without a full model run), fix it so patches on plain nn.Module parameters attach the same way in both modes (or at minimum fail loudly), and add a regression test on the patch bookkeeping if a synthetic repro is viable.

potoior avatar Nov 12 '26 05:11 potoior