Model
Trends
.ai
Model
Trends
.ai
les meilleurs modèles d'IA open source

Nœud KSampler dans ComfyUI

KSampler runs the denoising loop: it takes the model, prompts and a latent and produces the finished latent image, controlled by seed, steps, cfg, sampler, scheduler and denoise.
Pack de nœuds : ComfyUI core
Catégorie : Échantillonnage
Cette page n'est pas encore traduite ; elle est affichée en anglais.

Ce que fait KSampler

KSampler is where the image is actually generated. Starting from the input latent (random noise from Empty Latent Image, or an encoded picture for img2img), it asks the model to remove noise for the chosen number of steps, pulling toward the positive prompt and away from the negative one by the cfg amount. The result is a LATENT that VAE Decode turns into an image.
sampler_name selects the numerical method (euler, euler_ancestral, dpmpp_2m, dpmpp_2m_sde, dpmpp_3m_sde, uni_pc, lcm, ...) and scheduler the noise curve (normal, karras, exponential, sgm_uniform, simple, beta). denoise controls how much of the input latent is replaced: 1.0 for text-to-image, 0.3-0.7 for img2img and hires passes. KSampler (Advanced) exposes start and end steps for multi-stage sampling.

Entrées

Nom
Type
Rôle
model
MODEL
The denoising model, after any LoRA or ControlNet patches.
positive
CONDITIONING
What you want (from CLIP Text Encode, possibly through ControlNet Apply).
negative
CONDITIONING
What you do not want.
latent_image
LATENT
The starting latent: empty noise or an encoded image.
seed
INT
Noise seed. Same seed and settings reproduce the same image. control_after_generate sets fixed, increment, decrement or randomize.
steps
INT
Number of denoising steps. 20-30 for most SD models, 4-8 for Lightning, Turbo and LCM models.
cfg
FLOAT
Classifier-free guidance scale. 5-8 for SD 1.5 and SDXL, 1.0 for Flux and distilled models.
sampler_name
COMBO
The sampling algorithm.
scheduler
COMBO
The noise schedule.
denoise
FLOAT
Fraction of the noise to remove. 1.0 = start from scratch; lower keeps more of the input image.

Sorties

Nom
Type
Rôle
LATENT
LATENT
The sampled latent for VAE Decode or a second sampler.
AD
Oubliez l'installation : des workflows ComfyUI préinstallés sur le cloud
BitVector exécute des workflows ComfyUI prêts à l'emploi sur ses propres GPU. Rien à installer, aucun nœud manquant, aucune case rouge. Ouvrez-le sur votre téléphone ou votre portable et générez en une minute.

Comment utiliser KSampler

  1. Connect MODEL, both CONDITIONINGs and a LATENT.
  2. Set steps 25, cfg 7, dpmpp_2m with karras for SDXL; euler with simple, cfg 1 for Flux.
  3. Set denoise to 1.0 for a fresh image.
  4. Connect LATENT to VAE Decode and then Save Image.
  5. Queue, then fix the seed when you want to iterate on the prompt.

Réglages et conseils

  • dpmpp_2m + karras is the all-round choice; euler_ancestral adds variety but never converges; dpmpp_2m_sde gives extra detail at the cost of determinism across GPUs.
  • Lightning, Hyper and Turbo checkpoints need their own settings: 4-8 steps, cfg 1-2, sgm_uniform or simple.
  • For a hires pass, feed the first latent through Upscale Latent By and a second KSampler with denoise 0.4-0.55.
  • Hold Ctrl+Shift+V to paste a node with its connections; useful when duplicating samplers.
  • A fixed seed with the same settings is reproducible on the same GPU; different cards can differ slightly.

Dépannage de KSampler

Noise, static or a blurry blob instead of an image

Pourquoi cela arrive
The settings do not fit the model: cfg 7 on a distilled model, 4 steps on a normal model, a Flux model without Flux Guidance, or denoise far below 1 on an empty latent.

Comment le corriger
Match the model page: normal SD = 20-30 steps, cfg 5-8; Lightning/Turbo = 4-8 steps, cfg 1-2; Flux = cfg 1, guidance 3.5, 20+ steps. Use denoise 1.0 when the latent is empty.

Deep-fried, oversaturated, high-contrast output

Pourquoi cela arrive
cfg is too high for the model or the LoRA stack, or an ancestral sampler with many steps.

Comment le corriger
Lower cfg to 4-6, reduce LoRA strengths, or switch from euler_ancestral to dpmpp_2m.

torch.OutOfMemoryError: CUDA out of memory during sampling

Pourquoi cela arrive
The latent is too large for the card at this batch size, or another model (ControlNet, upscaler) sits in VRAM at the same time.

Comment le corriger
Lower the resolution or batch_size, add --lowvram, use fp8 weights, or split the hires pass into a second queue so the first model is unloaded.

Error: mat1 and mat2 shapes cannot be multiplied

Pourquoi cela arrive
The conditioning comes from a text encoder of a different family than the model (SD 1.5 CLIP into an SDXL model, or vice versa).

Comment le corriger
Wire the CLIP from the same checkpoint that provides the MODEL.

Images change every run although the seed is fixed

Pourquoi cela arrive
control_after_generate is set to randomize, or an SDE / ancestral sampler is in use with a non-deterministic backend.

Comment le corriger
Set control_after_generate to fixed and prefer dpmpp_2m or euler for exact repeatability.

The same image repeats across prompts (seed stuck)

Pourquoi cela arrive
control_after_generate is fixed and the noise dominates at low cfg or low steps.

Comment le corriger
Set it to randomize or increment and raise cfg slightly.

AD
Lancez ce workflow depuis votre téléphone
Chaque workflow de cette page est préinstallé sur BitVector, modèles et nœuds personnalisés déjà en place. Choisissez-en un, tapez un prompt, c'est fait. Zéro configuration, rien à télécharger.

Questions sur KSampler

What is the difference between KSampler and KSampler (Advanced)?

Advanced adds add_noise, start_at_step, end_at_step and return_with_leftover_noise, which lets you split sampling across two models, for example SDXL base then refiner.

Which sampler is fastest?

euler and dpmpp_2m take one model call per step; the _2s and _3m variants take more. LCM and Lightning models are fast because they need few steps, not because of the sampler.

What does denoise do with an empty latent?

Anything below 1.0 leaves part of the original noise in the output and produces fog. Keep 1.0 for text-to-image.

Nœuds liés

KSampler (Advanced)
ComfyUI core
KSampler (Advanced) is KSampler with step-range control: add_noise, start_at_step, end_at_step and return_with_leftover_noise, used for base + refiner chains and two-model sampling.
Empty Latent Image
ComfyUI core
Empty Latent Image creates the blank latent canvas (width, height, batch_size) that text-to-image sampling starts from; dimensions must be multiples of 8 and match the model family.
VAE Decode
ComfyUI core
VAE Decode converts the sampled LATENT into a pixel IMAGE with the VAE; VAE Decode (Tiled) does the same in tiles for very large images.
CLIP Text Encode (Prompt)
ComfyUI core
CLIP Text Encode turns a text prompt into CONDITIONING using the model text encoder. One node holds the positive prompt, a second one the negative prompt.
Upscale Latent and Upscale Latent By
ComfyUI core
Upscale Latent resizes a latent to a new size (or by a factor) so a second KSampler can add detail at higher resolution: the classic hires fix.
AD
Marre de réparer des nœuds ? Laissez faire le cloud
BitVector garde des centaines de workflows ComfyUI installés, à jour et testés sur des GPU cloud rapides. Pas de Python, pas d'erreurs CUDA, pas de limite de VRAM. Depuis n'importe quel navigateur.

Autres nœuds ComfyUI

ComfyUI Manager
ComfyUI-Manager
ComfyUI Manager is the extension that installs, updates and fixes custom node packs and models from inside the interface, resolves missing nodes in imported workflows and snapshots your setup.
Load Checkpoint
ComfyUI core
Load Checkpoint (CheckpointLoaderSimple) opens a .safetensors or .ckpt model file and hands out the three parts every workflow needs: the diffusion MODEL, the CLIP text encoder and the VAE.
Save Image
ComfyUI core
Save Image writes the IMAGE tensor to ComfyUI/output as a PNG, with the whole workflow embedded in the file metadata so the picture can be dragged back into ComfyUI to restore the graph.
Load Image
ComfyUI core
Load Image reads a picture from the ComfyUI input folder (or an upload) and outputs an IMAGE tensor plus a MASK taken from the alpha channel, the starting point for img2img, inpainting, ControlNet and IP-Adapter graphs.
Load LoRA
ComfyUI core
Load LoRA (LoraLoader) applies a LoRA file to the MODEL and CLIP with separate strengths, so a style, character or concept can be added to any checkpoint without merging.
Load Diffusion Model
ComfyUI core
Load Diffusion Model (UNETLoader) loads a bare denoising network such as Flux, SD3.5, Wan or HunyuanVideo from models/diffusion_models, with a weight_dtype option for fp8 to save VRAM.