Text encoder memory not released after #17361 (Combine Parallel Linear Weights), diffusion model loads partially

Open
#17,905 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, pytorch

Research direction

Start from the bisected commit 48b090cb6429 (#17361) and diff it against its parent 72bcda769, which the report marks as good. Reproduce with the listed flags (--disable-pinned-memory --cache-none --disable-dynamic-vram --disable-smart-memory --disable-async-offload) and check the "Requested to load QwenImage" line. Done when the diffusion model loads with full load: True after the text encoder has been unloaded.

Written by the indexing model from the issue text.

Description

Potential Bug
Custom Node Testing
Expected Behavior

The Qwen2.5-VL text encoder is fully unloaded after encoding, and the Qwen-Image diffusion model loads completely on every run, as in v0.44.0.

Actual Behavior

Since commit 48b090cb (#17361), part of the text encoder's VRAM is not released after encoding. The diffusion model then loads partially instead of completely.

With the attached workflow on current master (f99de883d, ComfyUI 0.46.0):

  • 1st run: loaded partially; 18811.95 MB usable, 18779.61 MB loaded, 769.44 MB offloaded
  • 2nd run: loaded partially; 18692.70 MB usable, 18662.38 MB loaded, 886.67 MB offloaded

On v0.44.0 (2c75dc1b3), the same workflow loads the diffusion model completely:

  • 1st run: loaded completely; 22879.26 MB usable, 19549.05 MB loaded, full load: True
  • 2nd run: loaded completely; 22790.01 MB usable, 19549.05 MB loaded, full load: True

An OOM warning from HIPCachingAllocator sometimes appears at the start of sampling, but generation completes. Generation is also slower because of the partial load: 3.10 s/it on v0.44.0 vs 3.19-3.33 s/it on f99de883d.

With a BF16 GGUF text encoder (Qwen2.5-VL-7B via ComfyUI-GGUF), the effect is larger: about 8 GB remains.

Note: comfy-kitchen differs between the two logs (0.2.40 on v0.44.0, 0.2.41 on f99de883d), but v0.44.0 with comfy-kitchen 0.2.41 also loads completely, so comfy-kitchen is not the cause.

Steps to Reproduce
  1. Start ComfyUI with:
    --disable-pinned-memory --cache-none --disable-dynamic-vram --disable-smart-memory --disable-async-offload --disable-all-custom-nodes
  2. Run the attached workflow (Qwen-Image 2512, 1024x1536, 40 steps):
  3. Check the "Requested to load QwenImage" line

git bisect between v0.44.0 (good) and 1332fabfc (bad):
48b090cb6429c92ac64000778679cbefce46be2d is the first bad commit.
Its parent 72bcda769 is good.

Qwen-Image-2512_05171_.json

Debug Logs
** ComfyUI startup time: 2026-11-21 23:40:15.235
[2026-11-21 23:40:15.235] ** Platform: Linux
[2026-11-21 23:40:15.235] ** Python version: 3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]
[2026-11-21 23:40:15.235] ** Python executable: /home/ubuntu/ComfyUI/venv-rocm10/bin/python3
[2026-11-21 23:40:15.235] ** ComfyUI Path: /home/ubuntu/ComfyUI
[2026-11-21 23:40:15.235] ** ComfyUI Base Folder Path: /home/ubuntu/ComfyUI
[2026-11-21 23:40:15.235] ** User directory: /home/ubuntu/ComfyUI/user
[2026-11-21 23:40:15.235] ** ComfyUI-Manager config path: /home/ubuntu/ComfyUI/user/__manager/config.ini
[2026-11-21 23:40:15.235] ** Log path: /home/ubuntu/ComfyUI/user/comfyui.log
[PRE] ComfyUI-Manager
[2026-11-21 23:40:17.678] Found comfy_kitchen backend hip: {'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_dtype', 'dequantize_int8_simple_dtype', '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', 'quantize_and_rotate_rowwise', 'quantize_convrot_w4a4_weight', 'quantize_int8_convrot_weight', 'quantize_int8_rowwise', 'quantize_int8_tensorwise', '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_', 'scaled_mm_svdquant_w4a4', 'sol_attn', 'stochastic_rounding_fp8', 'w4a8_int8_linear', 'window_attention']}
[2026-11-21 23:40:17.678] Found comfy_kitchen backend ascend: {'available': False, 'disabled': False, 'unavailable_reason': "torch-npu is not installed: No module named 'torch_npu'", 'capabilities': []}
[2026-11-21 23:40:17.678] 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']}
[2026-11-21 23:40:17.678] Found comfy_kitchen backend cuda: {'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_', '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', '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_svdquant_w4a4', 'sol_attn', 'stochastic_rounding_fp8', 'w4a8_int8_linear', 'w4a8_packed_linear', 'window_attention']}
[2026-11-21 23:40:17.678] 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']}
[2026-11-21 23:40:17.681] Checkpoint files will always be loaded safely.
[2026-11-21 23:40:17.689] Total VRAM 24560 MB, total RAM 64224 MB
[2026-11-21 23:40:17.689] pytorch version: 2.13.0+rocm10.0.0
[2026-11-21 23:40:17.690] Set: torch.backends.cudnn.enabled = False for better AMD performance.
[2026-11-21 23:40:17.690] AMD arch: gfx1100
[2026-11-21 23:40:17.690] ROCm version: (7, 15)
[2026-11-21 23:40:17.809] Set vram state to: NORMAL_VRAM
[2026-11-21 23:40:17.809] Disabling smart memory management
[2026-11-21 23:40:17.809] Device: cuda:0 AMD Radeon RX 7900 XTX : native
[2026-11-21 23:40:17.822] Using pytorch attention
[2026-11-21 23:40:19.704] Python version: 3.12.3 (main, Aug 31 2026, 10:18:26) [GCC 13.3.0]
[2026-11-21 23:40:19.704] ComfyUI version: 0.46.0
[2026-11-21 23:40:19.704] comfy-aimdo version: 0.6.0
[2026-11-21 23:40:19.704] comfy-kitchen version: 0.2.41
[2026-11-21 23:40:19.704] 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.
[2026-11-21 23:40:19.706] comfyui-frontend-package version: 1.59.10
[2026-11-21 23:40:19.706] comfyui-workflow-templates version: 0.11.114
[2026-11-21 23:40:19.706] comfyui-embedded-docs version: 0.5.17
[2026-11-21 23:40:19.706] comfy-aimdo version: 0.6.0
[2026-11-21 23:40:19.706] comfy-kitchen version: 0.2.41
[2026-11-21 23:40:19.707] [Prompt Server] web root: /home/ubuntu/ComfyUI/venv-rocm10/lib/python3.12/site-packages/comfyui_frontend_package/static
[2026-11-21 23:40:19.708] Asset seeder disabled
[2026-11-21 23:40:19.709] [START] ComfyUI-Manager
[2026-11-21 23:40:19.739] [ComfyUI-Manager] Using GitPython backend
[2026-11-21 23:40:19.741] ### Loading: ComfyUI-Manager (V4.2.2)
[2026-11-21 23:40:19.741] [ComfyUI-Manager] network_mode: personal_cloud
[2026-11-21 23:40:19.798] ### ComfyUI Revision: 6392 [f99de883] *DETACHED | Released on '2026-11-21'
[2026-11-21 23:40:19.904] [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/model-list.json
[2026-11-21 23:40:19.939] [ComfyUI-Manager] Legacy UI is enabled.
[2026-11-21 23:40:19.947] [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/alter-list.json
[2026-11-21 23:40:20.181] [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/extension-node-map.json
[2026-11-21 23:40:20.365] [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/github-stats.json
[2026-11-21 23:40:20.475] [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/Comfy-Org/ComfyUI-Manager/main/custom-node-list.json
[2026-11-21 23:40:20.652] No OpenGL_accelerate module loaded: No module named 'OpenGL_accelerate'
[2026-11-21 23:40:21.508] Skipping loading of custom nodes
[2026-11-21 23:40:21.566] Disabling intermediate node cache.
[2026-11-21 23:40:21.566] 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.
[2026-11-21 23:40:21.566] Starting server

[2026-11-21 23:40:21.566] To see the GUI go to: http://0.0.0.0:8188
[2026-11-21 23:40:29.354] [DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
[2026-11-21 23:40:29.688] [DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui/components/buttonGroup.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
[2026-11-21 23:40:29.698] [DEPRECATION WARNING] Detected import of deprecated legacy API: /scripts/ui/components/button.js. This is likely caused by a custom node extension using outdated APIs. Please update your extensions or contact the extension author for an updated version.
[2026-11-21 23:40:35.093] got prompt
[2026-11-21 23:40:35.102] Model storage policy: fast_disk=True paths=['/home/ubuntu/ComfyUI/models/vae/qwen_image_vae.safetensors']
[2026-11-21 23:40:35.110] Using split attention in VAE
[2026-11-21 23:40:35.113] Using split attention in VAE
[2026-11-21 23:40:35.278] VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
[2026-11-21 23:40:35.318] Found quantization metadata version 1
[2026-11-21 23:40:35.319] Using MixedPrecisionOps for text encoder
[2026-11-21 23:40:35.632] Model storage policy: fast_disk=True paths=['/home/ubuntu/ComfyUI/models/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors']
[2026-11-21 23:40:35.767] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[2026-11-21 23:40:35.768] Requested to load QwenImageTEModel_
[2026-11-21 23:40:39.475] loaded completely; 23140.80 MB usable, 7910.28 MB loaded, full load: True
[2026-11-21 23:40:41.981] Found quantization metadata version 1
[2026-11-21 23:40:41.981] Detected mixed precision quantization
[2026-11-21 23:40:41.981] Using mixed precision operations
[2026-11-21 23:40:41.981] Native ops: asym_w4a8_int8, convrot_w4a4, int8_tensorwise, w6a8_int8 , emulated ops: nvfp4, float8_e4m3fn, float8_e5m2, mxfp8
[2026-11-21 23:40:42.028] model weight dtype torch.bfloat16, manual cast: torch.bfloat16
[2026-11-21 23:40:42.037] model_type FLUX
[2026-11-21 23:40:42.038] Model storage policy: fast_disk=True paths=['/home/ubuntu/ComfyUI/models/diffusion_models/qwen-image-2512-int8-ConvRot.safetensors']
[2026-11-21 23:40:42.160] Requested to load QwenImage
[2026-11-21 23:40:51.315] loaded partially; 18811.95 MB usable, 18779.61 MB loaded, 769.44 MB offloaded, 27.02 MB buffer reserved, lowvram patches: 0
100%|█████████████████████████████████████ 100%|█████████████████████████████████████ █████| 40/40 [02:07<00:00,  3.19s/it]
[2026-11-21 23:43:00.849] Requested to load WanVAE
[2026-11-21 23:43:01.204] loaded completely; 17074.75 MB usable, 242.03 MB loaded, full load: True
[2026-11-21 23:43:02.140] Prompt executed in 147.05 seconds
[2026-11-21 23:43:11.351] got prompt
[2026-11-21 23:43:11.359] Model storage policy: fast_disk=True paths=['/home/ubuntu/ComfyUI/models/vae/qwen_image_vae.safetensors']
[2026-11-21 23:43:11.364] Using split attention in VAE
[2026-11-21 23:43:11.366] Using split attention in VAE
[2026-11-21 23:43:11.442] VAE load device: cuda:0, offload device: cpu, dtype: torch.bfloat16
[2026-11-21 23:43:11.479] Found quantization metadata version 1
[2026-11-21 23:43:11.480] Using MixedPrecisionOps for text encoder
[2026-11-21 23:43:11.733] Model storage policy: fast_disk=True paths=['/home/ubuntu/ComfyUI/models/text_encoders/qwen_2.5_vl_7b_fp8_scaled.safetensors']
[2026-11-21 23:43:11.861] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[2026-11-21 23:43:11.862] Requested to load QwenImageTEModel_
[2026-11-21 23:43:15.504] loaded completely; 22825.55 MB usable, 7910.28 MB loaded, full load: True
[2026-11-21 23:43:16.761] Found quantization metadata version 1
[2026-11-21 23:43:16.761] Detected mixed precision quantization
[2026-11-21 23:43:16.761] Using mixed precision operations
[2026-11-21 23:43:16.761] Native ops: asym_w4a8_int8, convrot_w4a4, int8_tensorwise, w6a8_int8 , emulated ops: nvfp4, float8_e4m3fn, float8_e5m2, mxfp8
[2026-11-21 23:43:16.807] model weight dtype torch.bfloat16, manual cast: torch.bfloat16
[2026-11-21 23:43:16.815] model_type FLUX
[2026-11-21 23:43:16.817] Model storage policy: fast_disk=True paths=['/home/ubuntu/ComfyUI/models/diffusion_models/qwen-image-2512-int8-ConvRot.safetensors']
[2026-11-21 23:43:16.919] Requested to load QwenImage
[2026-11-21 23:43:25.852] loaded partially; 18692.70 MB usable, 18662.38 MB loaded, 886.67 MB offloaded, 27.02 MB buffer reserved, lowvram patches: 0
[2026-11-21 23:43:29.130] FETCH ComfyRegistry Data [DONE]
[2026-11-21 23:43:29.426] [ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes
[2026-11-21 23:43:29.445] FETCH DATA from: /home/ubuntu/ComfyUI/user/__manager/cache/1514988643_custom-node-list.json [DONE]
[2026-11-21 23:43:29.483] [ComfyUI-Manager] All startup tasks have been completed.
Other

Good log (v0.44.0):
comfyui-v0.44.0.log

  • GPU: AMD Radeon RX 7900 XTX (gfx1100), 24 GB
  • OS: Ubuntu 24.04, kernel 6.8.0-149
  • PyTorch 2.13.0+rocm10.0.0
  • comfy-aimdo 0.6.0
  • --disable-dynamic-vram is required on this GPU (Dynamic VRAM fails with "VBAR allocation failed")
Dominant language
Python
Stars
150k
Forks
17.9k
Avg merge
1d 1h
Merged PRs (30d)
181

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Comfy-Org/ComfyUI

All issues in Comfy-Org/ComfyUI

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.