DOGMA Tile VLM Barrier v25 — Unload Before Klein
Unload the VLM before Klein starts, or watch 8GB of weights fight for the same card
- tiles
- tiles
- prompts
- preview
Tiled restoration on this pack is a two-model workflow, and they are not small. A vision-language model reads every tile and writes a report; then a Klein checkpoint samples every tile. If both are resident when the second phase starts, you are paying for the privilege in offload thrash.
This node is a synchronisation point. It doesn't transform anything - it waits and then evicts.
Why a barrier is needed at all
ComfyUI's execution model already batches, so you might assume the VLM is done before the sampler starts. Mostly true, and mostly not enough: the pack's tile workflows fan out reports and prompts through list-mode nodes, and the failure mode is partly-evaluated lists - some tiles have prompts, others don't, and the sampler runs on whatever exists. Forcing a node that consumes every prompt and every report into the graph makes the whole VLM phase evaluate before anything downstream of it.
Then it evicts: comfy.model_management.unload_all_models(), soft_empty_cache(), and a gc.collect(). One checkbox does both jobs.
The KB's LLM doc is the backdrop here - an in-graph VLM is a heavyweight, separately-installed model doing a text job upstream of your sampler, and the whole point of the pattern is that you're running two model families in one graph on one GPU. Klein's own doc adds the constraint on the other side: the 9B distilled checkpoint is the daily driver at 4 steps / CFG 1, and its text encoder is a separate Qwen3 file with its own footprint. Add a Qwen-VL tile inspector on top and the "fits" calculation from the earlier generation of workflows is out the window.
Inputs and outputs
tiles(IMAGE) - passed straight through.prompts(STRING) - passed through, as a list.reports(STRING) - consumed for the preview only.unload_models(BOOL, default true) - the actual work.
Outputs tiles and prompts, both lists, plus preview, a single concatenated string that pairs each tile's VLM report with the exact prompt Klein will receive, numbered by tile. That preview is the reason to keep the node even on a big card: it's the only place in the graph where you can read what the model was actually told, tile by tile, without guessing.
This node is list-mode in and list-mode out (INPUT_IS_LIST), so everything downstream has to expect lists.
Install
ComfyUI Manager → search DOGMA Nodes, or:
cd ComfyUI/custom_nodes && git clone https://github.com/axior/ComfyUI-DOGMA-Nodes
Restart. The node itself has no dependencies beyond ComfyUI's own model_management module - the pack's requirements.txt is # No external dependencies. - but the models it evicts are yours to install. Nothing here is documented in the repo README, which covers only the WAN VACE nodes and DOGMA samplers.
Where it bites
unload_all_models() is indiscriminate. It evicts everything ComfyUI is holding, not just the VLM. In a graph where a checkpoint or text encoder is meant to stay warm across a batch, you've just made the next phase reload from disk. On a 24GB card running one tile pass, turning the checkbox off is often the faster configuration - measure it rather than assuming.
It doesn't free the VLM in frameworks that hold their own reference. If your VLM node keeps weights in a process-global it never releases, ComfyUI's unload won't reach them. You'd see VRAM stay flat in nvidia-smi and conclude the node doesn't work. It did its job; the other node is the problem.
A barrier is not a scheduler. It serialises phases, it doesn't make them fit - and it can't stop the sampler from being handed a list whose reports were empty strings. If tiles come out untouched, read the preview output first: an empty report means the VLM stage, not this node.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| tiles | IMAGE | — | |
| prompts | STRING | — | |
| reports | STRING | — | |
| unload_models | BOOLEAN | true | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| tiles | IMAGE | — |
| prompts | STRING | — |
| preview | STRING | — |