Nodes/Comfyui-DiffusersUtils/Diffusers Sampling
ComfyUI Node

Diffusers Sampling

The sampler at the end of the diffusers road — and why its cfg default isn't a typo

By lrzjason·Created 9 months ago·Updated 8 months ago· 14
Diffusers Sampling
  • pipeline
  • diffusers_cond
  • negative_diffusers_cond
  • image
  • image
steps26
cfg1.5
num_images_per_prompt1
seed42
width1024
height1024

This is where the pack finally makes pixels. DiffusersSampling runs the actual diffusion loop - it takes the pipeline and the conditioning bundle built by the other nodes, calls the pipeline with your sampling parameters, and hands back a regular ComfyUI IMAGE tensor you can preview or save like any other.

Everything upstream in the pack is arguably preparation for this node: DiffusersPipeline loads the model, DiffusersTextEncode encodes the prompt, the GLM nodes add prior tokens, the LoRA nodes apply adapters. This is the payoff, and it's a decent one - the node handles plain text-to-image, image-editing pipelines, and the GLM prior-token path transparently, with no configuration switches to flip.

The inputs that matter

  • pipeline and diffusers_cond - required, from the loader and text-encode/prior-token nodes. If diffusers_cond carries width/height (which the GLM prior-token node adds), those override the width/height widgets on this node - worth knowing when the node seems to ignore your resolution.
  • steps - default 26, which suits the flow-matching schedulers these models use.
  • cfg - default 1.5, and no, that's not a typo. This is a flow-matching / guidance-distilled family, not SDXL. If your first instinct is to crank it to 7 because that's what you've always done, fight it: that habit is the single most common way people wash out images on 2026 models.
  • negative_diffusers_cond (optional) - leave it disconnected and the node silently substitutes a zeros tensor as the negative prompt embeddings. So an empty negative input doesn't error, it just means "no negative guidance," which for these models is usually fine. If you do encode a negative with DiffusersTextEncode, it gets used properly.
  • num_images_per_prompt - 1–8; batch within one call.
  • seed - your standard 64-bit seed, wired into a torch generator.
  • image - for edit pipelines. Give it a tensor and the node converts to PIL, then does a smart aspect-fit: leave width/height at their 1024 defaults and it uses the input image's exact dimensions; set custom width/height and it scales to fit within those bounds, preserving aspect ratio.
  • width / height - 256–4096 in steps of 64.

How it works

It pulls the prompt embeddings out of the cond bundle, builds the kwargs, and - the interesting bit - checks for prior_tokens. If present (GLM workflow), it extracts the token IDs and injects them as prior_token_ids / prior_image_token_ids into the pipeline call, which is the moment the AR stage's blueprint actually steers the diffusion. After generation it converts the PIL results back to a batched [B, H, W, C] tensor and, if the pipeline has LoRA weights loaded, calls unload_lora_weights() to clear them.

Install

ComfyUI Manager → "Comfyui-DiffusersUtils", or:

cd ComfyUI/custom_nodes
git clone https://github.com/lrzjason/Comfyui-DiffusersUtils

Restart ComfyUI. The pack's real dependency surface is ComfyUI's bundled diffusers/transformers/safetensors; the README's pip install -r requirements.txt will fail (there's no requirements.txt in the repo). If you're sampling GLM-Image, add the git-installs for transformers/diffusers/peft from the GLM nodes' instructions.

Troubleshooting

  • Washed-out or broken images - your cfg is probably too high (or you're feeding a literal (word:1.4) style prompt, which the Qwen-family encoders read as plain punctuation).
  • Node ignores width/height - the cond bundle is carrying its own resolution (GLM prior tokens set it). Change it at the source, the GenPriorTokens node.
  • VRAM is the real enemy here. LongCat's text encoder is an 8B Qwen2.5-VL model - people run it at fp8 for a reason, and the whole model set lands around 12.5 GB per variant. The edit model also got a mixed reception on quality relative to Qwen-Image-Edit at launch, so keep expectations in check on dense editing.
CategoryDiffusers/Sampling

Inputs (10)

NameTypeDefaultDescription
pipelinePIPELINE
diffusers_condDIFFUSERS_COND
stepsINT261–100
cfgFLOAT1.50–20
negative_diffusers_condoptDIFFUSERS_COND
num_images_per_promptoptINT11–8
seedoptINT420–18446744073709550000
imageoptIMAGE
widthoptINT1024256–4096
heightoptINT1024256–4096

Outputs (1)

NameTypeDescription
imageIMAGE