Nodes/ComfyUI-BerniniR/BerniniR · Source Stream (edición)
ComfyUI Node

BerniniR · Source Stream (edición)

Give each source its own identity in the model's head

By neuregex·Created 3 months ago·Updated 3 months ago· 24
BerniniR · Source Stream (edición)
  • model
  • source_latent
  • model
source_id1

BerniniR · Source Stream (edición) is the native-path way to tell the model "this is the video I'm editing, that one is a reference." It takes a source or reference latent, assigns it an integer source-id, and injects it into the model as a condition stream. Chain several of these and you get the multi-stream setup that makes Bernini's editing and reference work - each visual input living at its own phase in the RoPE grid instead of being smeared into the same tokens.

It's the native sibling of BerniniR · Encode Source/Reference: that node bundles video+references into one BR_SRC for the diffusers-path sampler, while this node stamps a single latent onto a native MODEL - which is what the GGUF path needs, because there the sampler is ComfyUI's own and the streams have to ride along in transformer_options.

Inputs

  • model (MODEL) - a Bernini-patched Wan model (from BerniniR · Load Model (native), or any native Wan model run through BerniniR · Apply Patches).
  • source_latent (LATENT) - the source/reference latent, from a VAE Encode using the Wan VAE. This is the one detail people get wrong: it must be a Wan VAE latent, not any other VAE's.
  • source_id (default 1, range 1–64) - the stream's identity. The generated target is always id 0. Every source/reference needs a distinct id ≥ 1. Chain multiple Source Stream nodes for multiple references, one id each.

How it works

Under the hood it clones the model, normalizes the latent with the model's own process_latent_in (the same mean/std normalization the target gets - skip that and the patch-embedding sees a mis-scaled stream, which shows up as the edit barely following the source), then appends {latent, source_id} to the bernini_streams list in transformer_options. When the forward runs, the patched model embeds each stream into its own token block and concatenates it before the target along the sequence axis, with a mask keeping only the target's output. The distinct source-id phases in the complex RoPE are what keep the streams distinguishable at the same spatial position.

Output

model (MODEL) - a cloned, patched model. Chain multiple Source Streams, then feed the last one to BerniniR · Guider, which reads the streams and decides per-step which subset each forward sees.

Install & troubleshooting

Shared pack install: ComfyUI Manager, or clone into custom_nodes + pip install -r requirements.txt.

  • Edit ignores the source? The latent wasn't normalized (old behavior) or it came from the wrong VAE. Re-encode with the Wan VAE and chain this node after the model already has Bernini patches.
  • No streams at all → runs as t2v. That's by design - without bernini_streams, the patched forward is stock Wan. The Guider's auto mode will then pick t2v and your source is quietly ignored. If you see that, the Source Stream isn't actually on the path into the Guider.
  • Two sources colliding? Give each its own source_id. The target is 0; don't assign 0 to a source.
  • This isn't the node that adds VRAM. Streams extend the sequence length (attention grows with it), which is part of why editing is heavy - but the mechanism itself is cheap.
CategoryBerniniR

Inputs (3)

NameTypeDefaultDescription
modelMODELMODEL de BerniniR Load Model (native).
source_latentLATENTLatente fuente/ref (VAE Encode con el Wan VAE).
source_idINT11–64ID del stream (>=1). Cada fuente/ref un id distinto; el target es 0.

Outputs (1)

NameTypeDescription
modelMODEL