Repository navigation
NORMAL_VRAM unloads resident non-dynamic models on every prompt after dynamic loading changes #14162
Description
Custom Node Testing
- I have tried disabling custom nodes and the issue persists (see how to disable custom nodes if you need help)
Expected Behavior
When running in NORMAL_VRAM with enough free VRAM, an already-loaded non-dynamic model should remain resident across prompt executions. Re-running the same workflow with only a seed change should not reload the diffusion model, and should not print "Requested to load " on every prompt.
Actual Behavior
After recent model_management.py changes, Comfy unloads/reloads a fully resident non-dynamic diffusion model on every prompt in NORMAL_VRAM, even when there is enough free VRAM.
On an RTX 3090 24GB, this adds roughly 1-2 seconds per prompt. With the local two-line patch below, the model remains resident and the same workflow returns to the expected timing.
Before patch:
- Each seed-only run prints "[INFO] Requested to load Anima"
- Prompt time: about 4.1-4.6s
After patch:
- No repeated "Requested to load Anima"
- Prompt time: about 2.1s
Steps to Reproduce
- Start ComfyUI on Windows with an RTX 3090 in NORMAL_VRAM mode.
- Use a workflow where the diffusion model fits fully in VRAM.
- Run the prompt once.
- Change only the seed and run again.
- Observe that Comfy requests/loads the diffusion model again despite sufficient free VRAM.
- Apply the guard change below and repeat; the repeated load no longer happens.
Debug Logs
T:\code\python\comfyui>call T:/programs/anaconda3/Scripts/activate.bat
[INFO] Adding extra search path diffusion_models S:\ai\diffusion_models
[INFO] Adding extra search path checkpoints S:\ai\checkpoints
[INFO] Adding extra search path vae S:\ai\vae
[INFO] Adding extra search path clip S:\ai\clip
[INFO] Adding extra search path clip_vision S:\ai\clip_vision
[INFO] Adding extra search path diffusers S:\ai\diffusers
[INFO] Adding extra search path text_encoders S:\ai\text_encoders
[INFO] Adding extra search path llm T:\ai\llm
[WARNING] WARNING: You need pytorch with cu130 or higher to use optimized CUDA operations.
[INFO] Found comfy_kitchen backend cuda: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
[INFO] Found comfy_kitchen backend triton: {'available': True, 'disabled': True, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8']}
[INFO] Found comfy_kitchen backend eager: {'available': True, 'disabled': False, 'unavailable_reason': None, 'capabilities': ['apply_rope', 'apply_rope1', 'dequantize_mxfp8', 'dequantize_nvfp4', 'dequantize_per_tensor_fp8', 'quantize_mxfp8', 'quantize_nvfp4', 'quantize_per_tensor_fp8', 'scaled_mm_mxfp8', 'scaled_mm_nvfp4']}
[INFO] Checkpoint files will always be loaded safely.
[INFO] Total VRAM 24576 MB, total RAM 65418 MB
[INFO] pytorch version: 2.8.0+cu126
[INFO] Enabled fp16 accumulation.
[INFO] Set vram state to: NORMAL_VRAM
[INFO] Device: cuda:0 NVIDIA GeForce RTX 3090 : native
[INFO] Using async weight offloading with 2 streams
[INFO] Enabled pinned memory 26167.0
[INFO] Using pytorch attention
[INFO] Python version: 3.10.14 | packaged by Anaconda, Inc. | (main, Mar 21 2024, 16:20:14) [MSC v.1916 64 bit (AMD64)]
[INFO] ComfyUI version: 0.22.0
[INFO] comfy-aimdo version: 0.4.5
[INFO] comfy-kitchen version: 0.2.8
[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.
[INFO] Initializing frontend: Comfy-Org/ComfyUI_frontend@latest, requesting version details from GitHub...
[INFO] [Prompt Server] web root: T:\code\python\comfyui\web_custom_versions\Comfy-Org_ComfyUI_frontend\1.46.4
[INFO] Asset seeder disabled
[INFO] Skipping loading of custom nodes
[INFO] Context impl SQLiteImpl.
[INFO] Will assume non-transactional DDL.
[INFO] Using RAM pressure cache.
[INFO] Starting server
[INFO] To see the GUI go to: http://127.0.0.1:8188
[INFO] got prompt
[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] CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cpu, dtype: torch.float16
[INFO] Requested to load AnimaTEModel_
[INFO] loaded completely; 21492.80 MB usable, 1136.88 MB loaded, full load: True
[INFO] model weight dtype torch.float16, manual cast: None
[INFO] model_type FLOW
[INFO] Requested to load Anima
[INFO] loaded completely; 21430.67 MB usable, 3988.40 MB loaded, full load: True
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:02<00:00, 2.75it/s]
[INFO] Requested to load WanVAE
[INFO] loaded completely; 18946.87 MB usable, 242.03 MB loaded, full load: True
[INFO] Prompt executed in 10.65 seconds
[INFO] got prompt
[INFO] Requested to load Anima
[INFO] loaded completely; 21417.67 MB usable, 3988.40 MB loaded, full load: True
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:02<00:00, 3.64it/s]
[INFO] Requested to load WanVAE
[INFO] loaded completely; 18936.87 MB usable, 242.03 MB loaded, full load: True
[INFO] Prompt executed in 5.34 seconds
[INFO] got prompt
[INFO] Requested to load Anima
[INFO] loaded completely; 21417.67 MB usable, 3988.40 MB loaded, full load: True
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:02<00:00, 3.63it/s]
[INFO] Requested to load WanVAE
[INFO] loaded completely; 18936.87 MB usable, 242.03 MB loaded, full load: True
[INFO] Prompt executed in 5.31 secondsOther
This appears to come from commit 5aa5ccc, where free_memory() changed the memory_to_free recomputation guard from applying to all models to only dynamic models.
Current behavior:
memory_to_free = 1e32
if current_loaded_models[i].model.is_dynamic() and (not DISABLE_SMART_MEMORY or device is None):
memory_to_free = 0 if device is None else memory_required - get_free_memory(device)For non-dynamic models, memory_to_free remains 1e32, so model_unload(1e32) is attempted even when there is no memory pressure.
Local patch that fixes the regression:
memory_to_free = 1e32
if not DISABLE_SMART_MEMORY or device is None:
memory_to_free = 0 if device is None else memory_required - get_free_memory(device)
if current_loaded_models[i].model.is_dynamic() and for_dynamic:
memory_required -= current_loaded_models[i].model.loaded_size()
memory_to_free = 0
Activity
coderabbitai commentedon May 29, 2026
🔗 Related PRs
#13735 - Reduce LTX2.3 peak VRAM when guide_mask is in use (CORE-166) [merged]
#13959 - implement/fix dynamic clip saving [merged]
#14031 - Fix reshaping lora application [merged]
#14052 - fixup threaded loader with worksplit multi-gpu [merged]
#14088 - Aimdo 0.4.5 + Cold marking of pins [merged]
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
lihaoyun6 commentedon May 29, 2026
Same problem. Everything was back to normal after applying this patch. Good job!
Ph0rk0z commentedon May 29, 2026
yea.. it seemed to stop my TE from unloading even when I switched back to main and the default comfyui-gguf plugin without rattus PR. So far tried with dynamic-disabled only. Will test some other WF and dynamic on.
EricBCoding commentedon May 30, 2026
Confirmed fixed after updating to master containing #14183. Seed-only reruns no longer reload the resident non-dynamic model in NORMAL_VRAM. Closing as resolved. Thanks.