Nodes/ComfyUI-BerniniR Wrapper/Bernini-R KSampler
ComfyUI Node

Bernini-R KSampler

Context windows, seven guidance modes, TeaCache, block swap

By xiaolibai-sys·Created 2 months ago·Updated 2 months ago· 9
Bernini-R KSampler
  • model_handle
  • positive
  • negative
  • latent_image
  • context_options
  • guidance_config
  • block_swap_args
  • teacache_args
  • guidance_schedule
  • latent
seed0
steps20
cfg6.0
sampler_name
scheduler
denoise1.00
flow_shift3.0
add_noisetrue

This is the hub of the whole pack. Where a stock ComfyUI KSampler takes a MODEL, this one takes a BERNINI_MODEL_HANDLE, and on top of normal sampling it can layer temporal context windows for long videos, a seven-mode guidance family, TeaCache acceleration, and GPU↔CPU block swapping. Disconnect all of those optional wires and it behaves like a normal KSampler - a good mental model for how to approach it: build the plain graph first, then bolt on the knobs one at a time.

How it works

The sampler loads the model through the lazy handle (weights hit GPU only when sampling starts), prepares noise, and delegates to the pack's internal sampling machinery. Every optional input is just a config object that switches machinery on: context_options enables windowed sampling for long videos, teacache_args installs block-skipping hooks, block_swap_args offloads transformer blocks to CPU, guidance_config replaces plain CFG with one of the fancier guidance strategies, and guidance_schedule overrides the static cfg with a per-step curve.

The inputs that matter

Required: model_handle, seed, positive/negative (CONDITIONING), latent_image, and the sampling trio:

  • steps - 20-40 for flow matching. Bernini-R typically wants 20+; editing can get away with fewer.
  • cfg - 4-7 typical for video, default 6. Overridden entirely if you connect a guidance_schedule.
  • sampler_name / scheduler - uni_pc or euler with simple or normal work well with flow matching, per the tooltips. flow_shift defaults to 3.0, which is what Bernini-R was trained with - higher shifts more steps toward low noise for sharper detail.

The optional wires, in the order you should add them:

  1. context_options (from BerniniR_ContextWindow) - the long-video VRAM solution.
  2. teacache_args (from BerniniR_TeaCacheArgs) - the speed solution.
  3. block_swap_args (from BerniniR_BlockSwapArgs) - the "I refuse to buy more VRAM" solution.
  4. guidance_config and guidance_schedule - quality tuning.

One input that trips people up: add_noise. Disable it for img2vid when denoise < 1.0 - otherwise you add fresh noise on top of an encoded image that's already meant to be preserved.

Output

One: latent (LATENT), which goes to BerniniR_VAEDecode. Standard.

Common issues, honestly

The README's troubleshooting list maps neatly onto this node. Gray or noisy frames → your guidance_schedule is mis-wired; guidance is applied in noise-residual space, not denoised space, so a wrong curve reads as washed-out video. OOM during sampling → lower context_frames, drop resolution, set force_offload in the prompt planner, or connect block swap. Seams between windows → raise context_overlap, switch fuse_method to pyramid, or use uniform_standard instead of static_standard.

And the meta-advice for this pack specifically: it's a self-contained alternative to Kijai's mainline ComfyUI Bernini integration, and it's newer and less battle-tested. The model underneath is the same - that 2x-compute editing cost, the 81-frame native window, no audio, no FLF - but if something behaves oddly here, the first diagnostic step is to disconnect all the optional config wires and confirm the plain sampling path works. Then add back one knob at a time.

CategoryBernini-R/Sampling

Inputs (17)

NameTypeDefaultDescription
model_handleBERNINI_MODEL_HANDLEBernini-R model handle from BerniniR_ModelLoader
seedINT00–18446744073709550000Random seed for reproducible generation
stepsINT201–10000Number of denoising steps. 20-40 for flow matching
cfgFLOAT6.00–100Classifier-free guidance scale. 4-7 typical for video
sampler_nameCOMBOSampling algorithm. 'uni_pc' or 'euler' work well with flow matching
schedulerCOMBOSigma schedule. 'simple' or 'normal' recommended
positiveCONDITIONINGPositive prompt conditioning
negativeCONDITIONINGNegative prompt conditioning
latent_imageLATENTInput latent (noise or encoded image for img2vid)
denoiseFLOAT1.000–1Denoising strength. 1.0 = full generation, <1.0 = img2vid
flow_shiftFLOAT3.00.1–100Sigma schedule shift. Bernini-R trained with 3.0. Higher = more low-noise steps, sharper details
context_optionsoptBERNINI_CTXContext window config from BerniniR_ContextWindow. Connect to enable temporal window tiling for long videos.
guidance_configoptBERNINI_GUIDANCE_CONFIGGuidance strategy + params from BerniniR_GuidanceConfig. Leave disconnected for plain CFG.
block_swap_argsoptBERNINI_BLOCKSWAPBlock swap config from BerniniR_BlockSwapArgs. Leave disconnected to disable.
teacache_argsoptBERNINI_TEACACHETeaCache config from BerniniR_TeaCacheArgs. Leave disconnected to disable TeaCache.
add_noiseoptBOOLEANtrueAdd initial noise. Disable for img2vid when denoise < 1.0
guidance_scheduleoptBERNINI_GUIDANCEDynamic per-step guidance scale from BerniniR_GuidanceStrengthSchedule. Overrides static cfg.

Outputs (1)

NameTypeDescription
latentLATENT