DGLS Model Loader
The loader that keeps your 12GB model out of your 8GB card
- model
- layers
If you've got a Wan 2.x or HunyuanVideo workflow and a card with 8–12GB of VRAM, you already know the pain: ComfyUI's default loader cheerfully tries to cram the whole diffusion model into VRAM and dies. DGLS - Dynamic GPU Layer Swapping - is one developer's answer to that. It's a two-node pipeline: this loader preps the model, and the Dynamic Swapping Loader does the actual GPU↔CPU shuffling while you sample. This is the front half, the node that does the weird heavy lifting at load time.
What it actually does
DGLS Model Loader is a drop-in replacement for the official "Load Diffusion Model" node, sitting in the loaders category. The difference shows up in its outputs: it returns model (MODEL) and layers (LAYERS). That second output is the unusual one - it's the pack's description of which blocks your model contains, so the swapping engine knows exactly what it can shuffle in and out. Wire both into the Dynamic Swapping Loader and you're off.
The reason this matters is architecture-aware layer extraction. The loader reads the state dict and pulls out a consistent sequence of layers whether you're running WAN/SDXL-style blocks, Flux's double_blocks/single_blocks, a HunyuanVideo model (which gets its own special case), or a generic transformer. Master weights stay on CPU; only small per-layer buffers sit on GPU. Then the engine downstream decides what to stage.
The inputs that matter
- model_name - pick from your ComfyUI
unetanddiffusion_modelsfolders. - model_type - set default and leave it there.
hunyuanexists for HunyuanVideo. Per the author's own tooltip,unetis "just for Debugging, its a legacy loader." You've been warned. - cast_dtype - ComfyUI's casting system (fp16, bf16, fp8 variants). Set it to
disabledif you'd rather usefull_cast. - full_cast - the pack's own casting, independent of ComfyUI's, which is the only path down to nf4/fp4. The tooltip is blunt: "Only cast in f8 or f4 if you have the kernals for it."
- clear_model_cache - forces a reload from disk, ignoring ComfyUI's cache. Handy when you swap a file and the old weights keep coming back.
- nuke_all_caches (optional) - the sledgehammer. "CAUTION: Aggressive Clear all ComfyUI caches." It can force other nodes to reload, so treat it as a last resort, not a habit.
- verbose - prints detection and dtype info, and yes, it slows inference.
Installing it
Via ComfyUI Manager, search for ComfyUI-DGLS. Or, the manual way:
cd ComfyUI/custom_nodes
git clone https://github.com/obisin/ComfyUI-DGLS
cd ComfyUI-DGLS
pip install -r requirements.txt
Then restart ComfyUI. Two gotchas here. First, the README's own clone command says dgls-comfyui - that path is stale, and the real repo is obisin/ComfyUI-DGLS. Second, the README capitalizes "REMEMBER TO INSTALL THE REQUIREMENTS.TXT" for a reason: the pack pulls in torch>=2.6, xformers, safetensors, psutil, and bitsandbytes. That last one is what makes the nf4/fp4 cast paths exist at all. Skip the requirements and you're running a hobbled version.
Fair warning
This is a pre-release project. The author's own note says it's still under active development and bug-testing, verified on an RTX 2060 and 2080Ti, and "I haven't promoted this or written about it." No community lore to lean on, no army of testimonials - just a dev who's shipping a clever idea early. Expect rough edges. If the official node works for you today, don't chase the 10–30% speed claim on a production workflow. But if your model doesn't fit, this is one of the few realistic paths.
Also note: it's currently for diffusion models - the README says OmniGen isn't working yet. And if you update the pack, recreate the node through the menu afterwards, or ComfyUI's node cache will keep handing you the old version.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| model_name | COMBO | 0 options: | |
| model_type | COMBO | default | Unet is just for Debugging, its a legacy loader- Use default |
| cast_dtype | COMBO | default | ComfyUI casting system. Use 'disabled' to turn off ComfyUI casting and use full_cast instead |
| full_cast | COMBO | disabled | Full cast system - cast entire model to target dtype including fp4. Works independently of ComfyUI's system. Only cast in f8 or f4 if you have the kernals for it. |
| clear_model_cache | BOOLEAN | false | Force reload model from disk, ignoring ComfyUI's model cache |
| verbose | BOOLEAN | false | This will slow down inference |
| nuke_all_cachesopt | BOOLEAN | false | CAUTION: Aggressive Clear all ComfyUI caches |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| layers | LAYERS | — |