DiffSynth: VRAM Limit
How much of your card the pipeline is allowed to eat
- vram_limit
Two widgets, one output, and the difference between a run that finishes and a run that dies with CUDA out of memory on the eighteenth step. This node tells the DiffSynth pipeline how much VRAM it may claim, reserves the rest for everything that isn't the pipeline.
What it does
You set device (cuda or cpu) and buffer_size - gigabytes, default 0.5, from 0 to 10 in half-GB steps. The node asks PyTorch how much memory the card has, subtracts your buffer, and returns the remainder as a number in GB. That number goes into the Loader's vram_limit input, and the pipeline budgets its weights and activations against it.
Simple, and quietly useful. ComfyUI is not the only thing on your GPU: your own models are cached, other nodes in the graph may hold tensors, and the desktop compositor is eating some too. A pipeline handed "all of it" will happily use all of it and take someone else's memory.
Reading the widgets
buffer_sizeis headroom you're reserving from the pipeline, not memory you're granting it. Raise it when other things in your graph are competing for VRAM or when you're running a second model in the same workflow; the pipeline will offload harder to stay under the ceiling.- 0 vs. 0.5. Zero means "use everything the card reports," which is a good way to find out what breaks. The 0.5 default exists for a reason.
- Big numbers are not free. On a 24GB card with
buffer_sizeat 8, the pipeline is told it has 16GB and it budgets accordingly: more offloading, more PCIe traffic, slower. It's a safety valve, not a speed dial. device: cpuon a machine with no CUDA returns infinity - effectively no limit. That's a graceful fallback, not a setting you're meant to choose.
Wiring it
The output vram_limit goes to the Loader's vram_limit input. One node per Loader; don't try to feed a ModelConfig with it - that takes VRAM Config, a different type entirely. The pair is easy to mix up:
| Node | Output type | Feeds |
|---|---|---|
| VRAM Config | vram_config | each ModelConfig |
| VRAM Limit | vram_limit | the Loader |
Both are "optional" in the docs' sense, in that the graph runs without them - you just get framework defaults, which are cautious about memory and slow by consequence.
Install
Ships with the pack: Manager → search DiffSynth-ComfyUI → install → restart. Or:
pip install git+https://github.com/modelscope/DiffSynth-Studio.git
cd ComfyUI/custom_nodes && git clone https://github.com/modelscope/DiffSynth-ComfyUI.git
No downloads, no model files, no dependencies beyond diffsynth itself.
Where people get it wrong
- Using it as a fix for a card that's genuinely too small. A cap doesn't create memory; it makes the pipeline offload more to host RAM, which is 10x slower. If you're capping to make something fit, check the VRAM Config first - pushing
computation_devicetocpuis sometimes the honest answer for a model that just doesn't belong on the card. - Setting
buffer_sizeto 10 and wondering why the run takes forever. You told it to leave 10GB free. - Expecting a warning. There isn't one. Overruns show up as an out-of-memory error at an arbitrary timestep, not a polite refusal at load.
- Combining
--lowvramlaunch flags with an aggressive pipeline cap. Two independent memory managers arguing is a bad time. Try the DiffSynth defaults first, then add ComfyUI flags only if you're actually short.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| device | COMBO | cuda | 2 options: cuda, cpu |
| buffer_size | FLOAT | 0.50–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| vram_limit | DIFFSYNTH_VRAM_LIMIT | — |