Dynamic VRAM pins the text encoder to GPU, leaving nothing for the diffusion model (MiniMax H3, 24 GB)

Open
#18,086 0 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
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python, pytorch

Research direction

Start by tracing the text encoder placement logic shown in the issue, especially the aimdo_enabled branch, and compare it with the behavior when dynamic VRAM is disabled. Check the history of #16374 and the related #16150 for intended memory management behavior. Done means the encoder can be released when the diffusion model needs VRAM, while preserving the intended dynamic VRAM behavior; reproduce with the supplied 24 GB MiniMax H3 workflow.

Written by the indexing model from the issue text.

Description

Expected Behavior

A MiniMax H3 fl2va workflow that fits in 24 GB loads the diffusion model to GPU and samples normally.

Actual Behavior

The text encoder is loaded to GPU and never released, so the diffusion model is offloaded in full and sampling runs from system RAM. No step completed in 9m43s.

Requested to load MiniMaxH3TEModel_
loaded completely; 21520.80 MB usable, 14960.20 MB loaded, full load: True
Requested to load MiniMaxH3VideoVAE
loaded completely; 21424.67 MB usable, 2665.86 MB loaded, full load: True
Requested to load MiniMaxH3
0 models unloaded.
loaded partially; 0.00 MB usable, 0.00 MB loaded, 15241.48 MB offloaded, 703.17 MB buffer reserved, lowvram patches: 0
  0%|          | 0/24 [09:43<?, ?it/s]

Encoder 14,960 MB + VAE 2,666 MB = 17,626 MB of 21,424 MB usable, leaving about 3.8 GB for a 15,241 MB model. 0 models unloaded — the encoder is not freed to make room, and --disable-smart-memory does not change this.

This appears to come from d39cdfdb0 ("Always put text encoder on GPU when dynamic vram on", #16374), which made encoder placement unconditional under aimdo_enabled:

if comfy.memory_management.aimdo_enabled:
    return get_torch_device()
elif vram_state in (VRAMState.HIGH_VRAM, VRAMState.NORMAL_VRAM):
    ...
Steps to Reproduce
  1. On a 24 GB card, load a MiniMax H3 fl2va workflow: minimax_h3_fl2va_pruned_w6a8 + qwen3vl_32b_minimax_h3_nvfp4_awq + minimax_h3_video_vae_int8_convrot.
  2. Queue it with dynamic VRAM at its default (enabled).
  3. Watch the load lines: the encoder loads completely, then the diffusion model reports 0.00 MB usable and is offloaded in full.
Workaround

--disable-dynamic-vram restores the previous behaviour and the model loads normally. Since the startup warning asks for detailed reports because the argument will be removed soon, this is that report.

Possibly relevant: the encoder here is the nvfp4 AWQ build, and nvfp4 is emulated rather than native on Ada, so keeping it resident buys no speed on this card. device: cpu on CLIPLoader is not an alternative either, since CPU has no nvfp4 support (d4056d50c).

Likely the same underlying problem as #16150.

Other
  • Windows 11, RTX 4090 24 GB (24,564 MB total), 128 GB RAM
  • ComfyUI 0.46.0 (18a5c7661), comfy-aimdo 0.6.0
  • PyTorch 2.7.0+cu128
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.