π§ Offload Model to DRAM
Offload the UNet so VAE decode actually fits β without waiting on disk
- model
- trigger
- memory_stats
- dram_id
- passthrough
The mirror image of the CLIP offload, and arguably the more useful half of the pair. Sampling a 20B Qwen-Image-Edit UNet leaves almost nothing for the VAE decode that comes after - which is when ComfyUI either spills to CPU, crawls, or dies outright. ArchAi3D_Offload_Model moves the diffusion model out of VRAM the moment the KSampler is done, so the decoder gets the card to itself.
What it does
A side-effect node in the same DRAM cache family as the CLIP version: grab the diffusion model, move its weights from VRAM to CPU RAM, pass your data through. The difference is placement in the pipeline. The CLIP offload goes before sampling; this one goes after - its example is literally "LATENT from KSampler β VAE Decode."
Inputs and outputs
model(required, MODEL) - the diffusion model to offload, straight from your model loader.trigger(optional, any type) - connect the KSampler's LATENT output here. The node runs because of the trigger, and the LATENT passes through untouched.
Outputs:
memory_stats(STRING) - live VRAM/RAM/cache status so you can verify the VRAM was actually freed.dram_id(STRING) - the cache key matching the pack's triggered model loader, so the same model reloads from RAM (~1s) instead of disk (~8s) on the next run.passthrough(any type) - the LATENT, unchanged, ready for the VAE decode.
How the mechanism works
The pack's shared dram_cache module holds strong references to offloaded weights in a module-level dict, so nothing gets garbage-collected mid-workflow. The offload node stashes the model there with a deterministic key, and partially_unload() keeps it tracked in ComfyUI's current_loaded_models - if something asks for the model again, ComfyUI auto-reloads it from RAM rather than re-reading the file. The README's pipeline is the clearest statement of intent: encode β offload CLIP β sample β offload model β decode with "full VRAM available."
When to reach for it
Same trigger points as its sibling: OOM at decode, ComfyUI thrashing between the UNet and VAE, or a workflow where you chain many edit passes and want each stage to have the whole card. The pack is tested on a 24GB 3090 Ti with the 20B model in fp8/quantized form, and the changelog specifies the two flags that make the system behave: --normalvram --cache-classic. If you're on a 24GB card running Qwen Edit, this pair of offload nodes is probably the difference between "it works" and "it works without babysitting."
Install
Same pack as everything else here:
cd ComfyUI/custom_nodes
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen && pip install -r requirements.txt
Or ComfyUI Manager β search "ArchAi3d Qwen". Restart; the node lives under ArchAi3d/Memory.
Gotchas
- Don't skip the trigger. No trigger, no guaranteed ordering - the offload can fire before the model is done sampling and you'll evict a model you're still using.
- RAM is the ceiling. The model sits in system RAM while cached. A 20B quantized model in DRAM plus the OS on a 16GB machine is a swap storm waiting to happen; the pack's DRAM guide recommends Linux
vm.swappinesstuning if you're on the edge. - It's manual by design. ComfyUI already has automatic management; this exists for when you want to say exactly when each model leaves the GPU. If ComfyUI's defaults are working for you, leave them alone.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Diffusion model to offload from VRAM to DRAM | |
| triggeropt | * | Connect KSampler LATENT output here β it passes through to 'passthrough' output |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| memory_stats | STRING | Current VRAM/RAM/cache status |
| dram_id | STRING | Cache key for this model in DRAM (matches loader's key) |
| passthrough | * | Pass-through of trigger input (e.g. LATENT β connect to VAE Decode) |