Nodes/ComfyUI-Apt_Preset/UC_create_context
ComfyUI Node

UC_create_context

The one wire that replaces twelve, and the shim for everything else

By cardenluo·Created 2 years ago·Updated about 15 hours ago· 334
UC_create_context
  • model
  • clip
  • vae
  • latent
  • audio_vae
  • context
  • model
  • clip
collapse_sampling_parametersfalse
steps20
cfg8.00
samplereuler
schedulernormal

ComfyUI-Apt_Preset's whole design is one sentence: bundle everything a generation needs into one object on one wire, and let each node take what it wants and put back what it changed. The author's README frames it as an answer to graphs that are "increasingly dense, making them difficult to understand and operate" - the noodle plate problem. Apt_Preset calls that bundle a RUN_CONTEXT, and UC_create_context is the simplest way to make one by hand.

If you already have a model, a clip and a VAE from anywhere in your graph - a checkpoint loader, an UNet loader from another pack, a LoRA stack - this node wraps them into a context the pack's sampler and controller nodes can consume. It's also the compatibility shim: it's how you adopt Apt_Preset's sampler nodes without adopting its loader.

What the context actually carries

Feed it model, clip and vae and it returns a context dict holding those three plus a set of sampling defaults: steps (20), cfg (8.0), sampler (euler) and scheduler (normal). Those are the parameters downstream nodes inherit when their own "inherit from context" toggle is on - which is the pack's central ergonomic idea. Set your steps once here and four samplers follow along.

The 0 = None tooltips are literal: set cfg to 0 or steps to 0 and the value becomes None in the context, meaning "not specified". Downstream nodes then fall back to their own defaults rather than inheriting a nonsense zero.

Optional extras worth knowing about:

  • latent - pass a latent in and it rides along in the context, so a sampler three nodes later can pick it up without a wire. This is the input that makes img2img-style chains possible without visible plumbing, and also the one that makes "why is my sampler using the old latent" a question you'll ask at least once.
  • audio_vae - a second VAE for audio. Audio-capable video models like MiniMax H3 decode sound and picture through different decoders, and the pack threads both through the same context.
  • collapse_sampling_parameters - as shipped, this one is accepted and ignored; the context always carries the sampling values. Treat it as a placeholder the author hasn't wired up yet rather than a switch that changes behaviour.

Outputs

Three, and the second two are the ones beginners miss: context, model, and clip. You get the bundle and the two raw sockets. That means a workflow can be half context-driven and half classic - take the context into UC_ksampler, and still wire model off this node into some other pack's nodes that don't know what a RUN_CONTEXT is. It costs nothing and it makes incremental migration possible.

The trade you're making

The KB's take on this pattern is worth repeating, because it's the honest one: the context bus cures spaghetti and causes staleness. With forty wires you can see that your LoRA output isn't connected to the sampler. With one wire, the connection is present and the contents are wrong - you're sampling a context assembled before the LoRA loaded, and nothing on the canvas tells you. When a change you made isn't showing up in the output, re-run the node that assembles the context before you debug anything else.

The second cost is lock-in. RUN_CONTEXT is this pack's invention, rgthree has its own Context, Easy-Use has a pipe dict, Efficiency Nodes had tuples - none of them talk to each other. Lean on the pack's context when a graph is big enough that legibility is your bottleneck; keep explicit wires in the region you're actively iterating.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
cd ComfyUI-Apt_Preset
pip install -r requirements.txt   # Windows: install.bat does the same loop

Restart ComfyUI, and the node lives under Apt_Preset/unit_context - Manager users can just search Apt_Preset. Heads up that this pack is a Chinese-community project (the author's tutorials are on Bilibili, and a lot of tooltips in older nodes are still Chinese-only); English-language discussion of it is close to nonexistent, even though it shows up high in install-count rankings. Don't take silence for "unsupported" - take it for "you may be the only person in the thread who's seen this error".

No models, no heavy extra deps beyond the pack's general list. If the node shows up but everything downstream is red, you've skipped pip install -r requirements.txt - the pack's module import fails as a whole and takes the whole Apt_Preset/* category with it.

CategoryApt_Preset/unit_context

Inputs (10)

NameTypeDefaultDescription
modelMODEL
clipCLIP
vaeVAE
latentoptLATENT
audio_vaeoptVAE
collapse_sampling_parametersoptBOOLEANfalse仅折叠参数,如果后端缺这些参数,则会被采用
stepsoptINT200–100000 = None
cfgoptFLOAT8.000–1000 = None
sampleroptCOMBOeuler45 options: None, euler, euler_cfg_pp, euler_ancestral, euler_ancestral_cfg_pp, heun, +39
scheduleroptCOMBOnormal10 options: None, simple, sgm_uniform, karras, exponential, ddim_uniform, +4

Outputs (3)

NameTypeDescription
contextRUN_CONTEXT
modelMODEL
clipCLIP