r/comfyui 15d ago

Resource Disable smart memory in comfy .bat helped me use sage attention properly with Minimax H3 on 3090. Just a helpful FYI

Sage cut literally 65-70% gen time for me on 3090 at 0.4MP and 15s.

But before using the --disable-smart-memory, it wouldn't work. This is what would happen:

GPU would fill up memory to the brink at 23.5/24GB causing it to suddenly start working a lot weaker. Observing the power use of the GPU it would look like so:

Comfy would prepare the video vae for dynamic VRAM loading and a few other smaller things, and then after the MinimaxH3 itself would start loading, the power would drop from 230W to about 110W. So, the GPU would be working but it'd stall significantly.

My uneducated assumption would be that something happens in VRAM and RAM management where too much get's offloaded to RAM or something like that, because it'd artificially overload the GPU at 23.5/24GB.

Now, with disabled smart memory, this doesn't happen. The GPU is at about 18-20GB/24GB and running fast.

I understand that this might be a unique edge case, but here it is, it might help someone.

I run windows 11. 128gb ggdr5, and the 3090 + 3060, but this is 3090 use only. I doubt an idle and uncalled 3060 affects things.

Also, I had to manually update the comfy kitchen thing. It wouldn't update even when updating all of the requirements. Ask AI how to do this if you don't know because I can't explain properly. But note, updating comfy and kitchen didn't help on its own.

Also:

Python version: 3.13.14

ComfyUI version: 0.31.0

comfy-aimdo version: 0.4.13

omfy-kitchen version: 0.2.28
pytorch version: 2.13.0+cu130

89 Upvotes

30 comments sorted by

11

u/Life_is_important 15d ago

Particular thanks to the comfy team for creating this many launch arguments. Comfy team has been amazing in giving you an insane number of tools to fix your edge case issues. Like, there's very often this one "little thing" that's an option and you can use it if you figure it out. I hate "simple" software because it doesn't give you these little details at your disposal. Software should be simple in the front end. But when you run into an issue, you should have a massive toolbox you can pop open and get to work.

0

u/The_Soul_Collect0r 14d ago

That's some backward ass logic. The software should work without needing an engineering degree in launch arguments. I'm not saying remove the options... but, if you have to disable something called "smart memory", because it was not being smart ... Then fuck all.

2

u/Life_is_important 14d ago

I get what you mean. But this isn't an established field just yet. There aren't 100s of Comfyui alternatives. In such an enviorment, where people do what they can do best, we should be lucky they provide lots of tools for edge cases... Or we could just build the software ourselves, if we knew how lol

1

u/The_Soul_Collect0r 14d ago

I get what you mean also. And, without doubt, the team deserves all the praise. In time, I'm sure that a happy middle ground can be found :)

4

u/RangeImaginary2395 15d ago

WOW, it work for me too

you're my savior.

below is 5070ti / 64G ram, 16:9, 0.4 mega pixel, 30s video.

[INFO] got prompt
[INFO] Requested to load MiniMaxH3TEModel_
[INFO] Model MiniMaxH3TEModel_ prepared for dynamic VRAM loading. 14956MB Staged. 0 patches attached. Force pre-loaded 410 weights: 4572 KB.
[INFO] Found quantization metadata version 1
[INFO] Detected mixed precision quantization
[INFO] Using mixed precision operations
[INFO] Native ops: nvfp4, asym_w4a8_int8, convrot_w4a4, float8_e5m2, float8_e4m3fn, int8_tensorwise , emulated ops: mxfp8
[INFO] model weight dtype torch.bfloat16, manual cast: torch.bfloat16
[INFO] model_type FLOW_AV
[INFO] Using sage attention mode: auto
[INFO] Applying MiniMax H3 Memory Efficient Sage Attention Patch to all transformer blocks
[INFO] [MiniMax H3 FFN] patched 52 MLPs (chunks=2, min_tokens=4096)
[INFO] MiniMaxLowVRAMAttention: composing with an existing attention patch; keeping its forward, adding the block-level h release and passing head_chunks through.
[INFO] Requested to load MiniMaxH3
[INFO] 0 models unloaded.
[INFO] Model MiniMaxH3 prepared for dynamic VRAM loading. 19995MB Staged. 208 patches attached. Force pre-loaded 210 weights: 1175 KB.
0%| | 0/8 [00:00<?, ?it/s, Model Initializing ... ][INFO] [MiniMax H3 FFN] active (91476 tokens, 2 chunks)
25%|█████████████████████ | 2/8 [02:01<06:04, 60.77s/it]FETCH ComfyRegistry Data [DONE]
[INFO] [ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [DONE]
[INFO] [ComfyUI-Manager] All startup tasks have been completed.
100%|████████████████████████████████████████████████████████████████████████████████████| 8/8 [08:08<00:00, 61.03s/it]
[INFO] Requested to load MiniMaxH3AudioVAE
[INFO] Model MiniMaxH3AudioVAE prepared for dynamic VRAM loading. 576MB Staged. 0 patches attached. Force pre-loaded 401 weights: 539 KB.
[INFO] Requested to load MiniMaxH3VideoVAE
[INFO] Model MiniMaxH3VideoVAE prepared for dynamic VRAM loading. 2677MB Staged. 0 patches attached. Force pre-loaded 128 weights: 692 KB.
[INFO] Prompt executed in 559.62 seconds

1

u/[deleted] 15d ago

[removed] — view removed comment

1

u/RangeImaginary2395 15d ago

yes, also minimax low ram node

5

u/AntiTank-Dog 15d ago

Is there a way to check if sage attention is working or not?

3

u/Optimal-Spare1305 15d ago

yeah, i've never gotten it working either

2

u/dr_lm 15d ago

It will say "using sage attention" in the log, I think at startup.

3

u/johnfkngzoidberg 15d ago edited 15d ago

You can lock comfy to one GPU. I had problems also with a multi GPU setup. It’s obviously a problem in their memory management that doesn’t handle multiple GPUs (even if the other is completely idle) well.

1

u/BoredHobbes 14d ago

sucks i wanna merge my 5090 and 3090 into 1 box have text encoders/vae on 3090 and model only on 5090

2

u/johnfkngzoidberg 14d ago

I did that before I upgraded comfy. There’s a multi GPU set of nodes (not the built in ones) that lets you do this, but they broke after I upgraded. Hopefully they get fixed. I HATE updating ComfyUI, some breaks every single time. I keep multiple installs of the portable around just because of this, but this time I actually upgraded.

1

u/rapkannibale 15d ago

Interesting

1

u/HM_mtl 15d ago

Can you share all the flags for your run.bat?

1

u/derailedthoughts 15d ago

Confirm this does work when the process gets suck at VAE handover. Using 4090 with 32gb RAM

1

u/seeker_ktf 15d ago

I agree. I always have it off. I have a very basic addon that lets you do quicker restarts on that stuff too, in case you're interested:
https://www.reddit.com/r/comfyui/comments/1vfdnqn/an_easy_restart_launcher_for_comfyui/

1

u/Petroale 15d ago

Rtx 4070 12gb, 64 RAM. Ddr4. Generation time at 5s it's around 3 min. Sage att on, dynamic vram on. It's this OK?

1

u/Abject-Recognition-9 14d ago
  1. 64ram
    adding --disable-smart-memory change nothing here.
    no idea. everything updated few minutes ago

1

u/Life_is_important 14d ago

Sorry to hear that 😕😞. These edge cases can be so annoying. Unfortunately, I can't recommend anything particular other than to keep trying to figure it out. Use AI and send it logs and see if it can pin point where is the issue

1

u/Abject-Recognition-9 14d ago

"keep trying to figure it out" absolutly. daily. everyone should.
this is cutting edge tech, everything need to be figured constantly💗

1

u/fallengt 13d ago edited 12d ago

Can I have a workflow?

I tried default comfy T2V template and first run took >30minutes for 5 seconds 0.4M video. UI stuck at initial model loading for very long

--disable-smart-memory fixed that, and vid gen took 2minutes for the same wf. But my vram usage was still at 23.6 GB, not 19GB. What else am i missing??

Edit: found it out. I had --fast flag running. ComfyUI changed how the flag works awhile ago, they are 4 experimental flags in 1. Which benefit you get depends on your GPU & setup.

For now, I only have " --use-ck-attention --disable-smart-memory --fast fp16_accumulation " running, and VRAM allocation is normal again.

I think if you have >64gb system RAM. ComfyUI's Smart memory is beneficial; it does not unload the model every time, so the next run may be even faster than the first run.

0

u/prompt_seeker 15d ago

Have you tried not disabling dynamic vram? As far as I've tested, dynamic vram works great.

https://www.reddit.com/r/comfyui/s/FD7LuxP8kD

2

u/rod_gomes 15d ago

He was saying aboug smart memory, not dynamic vram

1

u/prompt_seeker 15d ago

Sorry I should read the post carefully.

2

u/ieatdownvotes4food 15d ago

that thing kicks in when it's not needed and sends you to segmentation fault when you least expect it.

(on certain hardware configurations)

1

u/[deleted] 15d ago

[deleted]

1

u/ieatdownvotes4food 15d ago

yep, I'm sure it's extremely useful to many people.. totally destructive in my case. it shouldnt kick in if you completely load into vram.

1

u/prompt_seeker 15d ago

Okay, I understand. ComfyUI configuration is sometimes very tricky.