Nodes/Eden.art nodesuite/Random_Style_Mixture
ComfyUI Node Runs on cloud

Random_Style_Mixture

Roll the Dice on Style, the IP-Adapter Way

By edenartlabΒ·Created 3 years agoΒ·Updated 6 months agoΒ· 119
Random_Style_Mixture
  • style_embeddings
  • pos_embed
  • batch_size
β—„avg_embed_norm300.0β–Ί
β—„num_samples4β–Ί
β—„num_style_components4β–Ί
β—„min_weight0.20β–Ί

Style fatigue is real: you've got twenty reference images and you keep reaching for the same two. Random_Style_Mixture is the pack's answer - it samples random blends of your style embeddings, so each run hands you a different, never-quite-seen style direction. Think of it as a style lottery, and it's the most fun node in the Eden embedding family.

You feed it one EMBEDS stack - the kind Load_Embeddings_From_Folder produces from a folder of saved .pth files - plus avg_embed_norm, which is that loader's second output (the average vector norm of your stack, used as the renormalization target). Then it does this, per sample:

  1. Randomly pick num_style_components (default 4) styles from the stack.
  2. Give each a random weight sampled from [min_weight, 1.0] (default min_weight 0.2), normalized so the mean weight is 1.
  3. Sum the weighted styles into one blend, then rescale it to avg_embed_norm so the result sits at the same "volume" as your originals.

It repeats that num_samples (default 4) times, so the output pos_embed is a small batch of random style directions, and it also returns batch_size (the actual count) as an INT in case you want to wire the number into a batch-aware node downstream. Each sample uses torch.randperm, so the selection is fresh every run.

Why this works

Two ideas make it taste good. First, IP-Adapter embedding space is roughly arithmetic - blending directions and re-normalizing lands you on plausible in-between styles, same reason Linear_Combine_IP_Embeds interpolates smoothly. Second, the num_style_components-with-random-weights design means you're not just picking one style or a straight average; you're getting genuinely new combinations, some close to an original, some surprising mixtures. min_weight keeps the blends honest by stopping a single style from vanishing entirely. For creative exploration - "I don't know what I want, show me options" - it's the node that hands you a spread.

Installing it

Part of the Eden.art nodesuite, under Eden 🌱. ComfyUI Manager β†’ search "Eden" β†’ install, or:

cd ComfyUI/custom_nodes/
git clone https://github.com/edenartlab/eden_comfy_pipelines.git
cd eden_comfy_pipelines
pip install -r requirements.txt

Restart to load it.

Common issues

The assert that bites: num_style_components can't exceed the number of embeddings in your stack - asking for 6 components from a 4-image library fails with an assertion error, so keep the two in step. Also note min_weight is a floor on individual weights, not a knob for "how much style," so raising it narrows variety more than it strengthens the effect. And because selection is random per run, results aren't seed-reproducible within the node itself - if you want a specific blend on demand, that's what Linear_Combine_IP_Embeds is for. The random node is for exploration; the deterministic one is for decisions.

CategoryEden 🌱

Inputs (5)

NameTypeDefaultDescription
style_embeddingsEMBEDSβ€”
avg_embed_normFLOAT300.00–500β€”
num_samplesINT4β€”
num_style_componentsINT4β€”
min_weightFLOAT0.200–1β€”

Outputs (2)

NameTypeDescription
pos_embedEMBEDSβ€”
batch_sizeINTβ€”