Nodes/ComfyUI_Yvann-Nodes/Floats To Weights Strategy
ComfyUI Node

Floats To Weights Strategy

Hand IPAdapter a per-frame weight curve that isn't a flat line

By yvann-ba·Created 2 years ago·Updated 6 months ago· 708
Floats To Weights Strategy
  • floats
  • WEIGHTS_STRATEGY

IP-Adapter's ComfyUI implementation has a clean way to vary how strongly a reference image influences each frame: the weights strategy. Instead of a single static weight, you give it a per-frame curve. The catch is the format - a specific dictionary with timing, frame counts, and a comma-separated weight string. Typing that by hand is miserable. Floats To Weights Strategy builds it for you from a plain list of floats.

How it works

One input: floats (a FLOATS list - e.g. audio_weights from Audio Analysis, peaks, or any custom curve). One output: WEIGHTS_STRATEGY.

The node counts your frames, formats the weights into the "0.000, 0.234, 0.500, ..." string the strategy expects, and packs it all into a dictionary with timing: "custom", start/end frames, and method: "full batch". It's pure formatting - no math, no model, instant.

The strategy output plugs into IPAdapter nodes from cubiq's pack that accept a weights strategy - IPAdapter Weights From Strategy or Prompt Schedule From Weights Strategy - which then feed the actual per-frame weights into an IPAdapter Apply node.

Why it exists

The whole point of the Yvann pack is audio-reactive control, and IPAdapter is one of the best "driven" tools in the ecosystem - a 22M-parameter adapter that injects an image embedding through its own cross-attention path so a reference image steers style and composition without touching the text prompt. But out of the box, an IPAdapter weight is a single number you leave static. If you want the reference's influence to pulse with the beat or swell into a chorus, you need a strategy - and that's this node's job.

So the flow you'll actually build: Audio Analysis → Floats To Weights Strategy → IPAdapter Weights From Strategy → IPAdapter → your sampler. The reference image stops being a static look and becomes a breathing one.

Gotchas

  • The weights are passed through nearly untouched - this node formats, it doesn't normalize. If your floats sit in a weird range, IPAdapter will interpret them literally. Run them through Edit Audio Weights first if they need smoothing or rescaling.
  • The strategy is "full batch," meaning one continuous curve for the whole clip. If you want per-section strategies, split your float list first.
  • It's a pure pass-through, so don't expect any error checking - a FLOATS list with the wrong length will produce a strategy with that length, and downstream nodes will complain if it doesn't match the frame count.

Install

The pack, one more time:

cd ComfyUI/custom_nodes
git clone https://github.com/yvann-ba/ComfyUI_Yvann-Nodes

or ComfyUI Manager → search ComfyUI_Yvann-Nodes. You'll also need cubiq's IPAdapter pack (Manager → "ComfyUI_IPAdapter_plus") for the strategy-consuming nodes - this node is useless without it, so grab both in one session.

Category👁️ Yvann Nodes/🔄 Convert

Inputs (1)

NameTypeDefaultDescription
floatsFLOATSList of floats to convert to IPAdapter weights strategy

Outputs (1)

NameTypeDescription
WEIGHTS_STRATEGYWEIGHTS_STRATEGY