How to use from the
Use from the
Diffusers library
pip install -U diffusers transformers accelerate
import torch
from diffusers import DiffusionPipeline

# switch to "mps" for apple devices
pipe = DiffusionPipeline.from_pretrained("0ppxnhximxr/snapref-v2a-pre2", dtype=torch.bfloat16, device_map="cuda")

prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
image = pipe(prompt).images[0]
SnapRef v2a-pre2

SnapRef v2a-pre2

Preview build. One reference image, your character in any pose and scene you prompt.

This is a preview, not a final release. It does not replace SnapRef v1a, which stays the recommended version for everyday use. v2a-pre2 is step 15,000 of the v2a run; an earlier checkpoint of the same run is v2a-pre1 (step 10,000).

Please support SnapRef! Developing these models has taken 400+ H100 GPU-hours so far. If SnapRef is useful to you, a ⭐ on GitHub, sharing your results or reporting issues helps a lot, and GPU sponsorship is very welcome.

A reference adapter for Anima base v1.0. The reference is read once and reused at every sampling step. The ComfyUI node in this repository also works with v1a and v1b.

SnapRef v2a-pre2: one reference image, any pose, any scene

References not in the training data. The prompt describes only the scene: no character name, appearance or artist tags.

What is new

🎨 Character reference (mode char) Takes the character from the reference and leaves its art style behind; the base model and your prompt set the style. The largest change against v1a.
🧩 Several references of one character image, image_2, image_3: for example an upper-body shot for the face and a full-body shot for the outfit.
βš–οΈ Reference weights weight_1 … weight_3: how much each reference counts, including mixing two characters.
⚑ No slowdown from strength and weights Both now run on the fused attention kernel. A10, 832Γ—1216, 28 steps: strength 1 went from 27.8 s to 25.7 s per image (no strength: 24.9 s).

Character reference

mode char: v1a vs v2a-pre2

Same reference, prompt and seed in every column. With mode char, v2a keeps hair, eyes and outfit and drops the reference's colouring and line style. The cs column (character and style) is shown for contrast.

mode char with style tags

mode char with style tags in the prompt: the reference keeps the character, the prompt picks the look.

Several references of one character

multi-reference

Connect a second (and third) picture of the same character to image_2 / image_3. Each reference is encoded on its own and the image reads all of them, so details that only one picture shows (shoes, a full outfit) are kept. Keep solo in the prompt. For two different characters in one image, use the two-characters workflow (references stitched side by side) instead.

Measured with v1a on 96 unseen characters (upper-body + full-body reference): two references matched the character more closely than either one alone and never produced two people. The node works the same way with v2a.

Reference weights

reference weights

weight_2 = 0.4 means: mostly the first image, a little of the second. 0 skips a reference. Weights are applied as log(w) on that reference's attention keys and only work with multi_layout: separate.

Quick start

  1. Install Anima base v1.0 with its text encoder and VAE.
  2. Copy comfyui/snapref/ into ComfyUI/custom_nodes/ (replace an older SnapRef node) and restart ComfyUI.
  3. Put snapref_v2a_pre2.safetensors into ComfyUI/models/loras/.
  4. Open workflows/snapref_v2a_pre2_simple.json, click the picture slot in the SnapRef node and queue.

Write only the scene. Hair, eyes, outfit (and, in cs mode, the style) come from the reference.

masterpiece, best quality, score_7, safe, 1girl, solo, full body, standing, looking at viewer, smile, park, day

The adapter is not a regular LoRA. Load it with the SnapRef node, not with LoraLoader. Direct loading with the Diffusers API is not supported.

Two nodes. SnapRef is the simple one: pick one or two pictures of the character inside the node, choose Character & Style or Character, and set Strength and Fidelity. SnapRef (Advanced) has every setting described below. Saved workflows open on SnapRef (Advanced) unchanged.

Settings

The settings below are the inputs of SnapRef (Advanced). The simple node keeps everything else at these defaults.

input default
adapter snapref_v2a_pre2.safetensors or the FP8 file
mode cs cs: character and style from the reference. char: character only; put style or artist tags in the prompt
ref_in_uncond off off: only the positive branch reads the reference (as trained). On: weaker, closer to the prompt
fidelity 1.0 0-1; lower follows the prompt more freely. Ignored when ref_in_uncond or ref_guidance_on is on
ref_megapixels 1.0 the reference is shrunk (never enlarged) to this area
strength 0 attention to the reference, log scale: +1 β‰ˆ 2.7x more, βˆ’1 β‰ˆ 2.7x less
ref_caption empty optional appearance tags of the reference; no name or artist
ref_guidance_on / ref_guidance / correction / ref_end off / 4.5 / apg / 1.0 separate reference guidance (one extra model call per step)
image_2, image_3 more references of the same character
use_batch off use every image of an IMAGE batch as a reference
multi_layout separate separate: each reference on its own. stitch: side by side in one reference (same speed as one)
weight_1 … weight_3 1.0 how much each reference counts (0–2); separate layout only

Saved workflows from v1a open unchanged: the new inputs are at the end of the node.

How it compares

Detail evaluation on 64 cases Γ— 2 seeds (32 unseen generated characters + 32 real-art characters not in any training data). Numbers are the difference to v1a; 95 % confidence interval in brackets.

metric v2a-pre1 (10k) v2a-pre2 (15k) better
appearance tags kept (hair, eyes, outfit) βˆ’0.014 [βˆ’0.047, +0.019] βˆ’0.015 [βˆ’0.051, +0.021] higher
head-crop match, SigLIP2 βˆ’0.018 [βˆ’0.025, βˆ’0.011] βˆ’0.005 [βˆ’0.010, βˆ’0.001] higher
head-crop distance, CCIP +0.010 [+0.003, +0.017] +0.005 [+0.001, +0.009] lower
head-crop distance, CCIP, real-art references +0.019 [+0.009, +0.032] +0.010 [+0.004, +0.015] lower
full-body distance, CCIP +0.008 [0.000, +0.017] +0.007 [+0.002, +0.013] lower
  • In cs mode, v2a-pre2 is close to v1a but not better: the head-crop scores are slightly lower, most of all with real artwork as the reference. This is why it is a preview.
  • The mode char result above (style left behind) is the visible improvement. It is shown with examples, not with a score yet.
  • With mode char, a few outfit details of the reference can change (in our checks: camouflage pants drawn plain, a hat left out).

Training

Continued from v1a for 15,000 steps (batch 16, lr 1e-4) on a mix of real and generated illustrations: 80 % real Danbooru illustrations (231,724 images, 33,666 characters) and 20 % images generated with Anima (scenes3x4, 58,300 images, 2,367 characters). LoRA rank 128 (reference) / 64 (target), same structure as v1a. The training config is in training_config.json.

The Danbooru part was selected by tags only (no image classifier): one character, one artist, solo, no AI-generated or layout tags. It includes questionable and explicit posts of adult characters. Characters on a minor list, and any post with minor tags, were limited to the general and sensitive ratings. The generated part is safe only.

The next run will use generated images only; this mix is why v2a is released as a preview.

FP8

snapref_v2a_pre2_fp8.safetensors is half the size (195 MB). The node dequantizes it at load; compute stays bf16.

Compatibility and troubleshooting

  • Black image with an fp16 model or --fast: fixed in this node. With an older node, add --bf16-unet to the ComfyUI launch arguments.
  • Anzhc Mod Guidance: works in either node order.
  • Spectrum: works with ref_guidance_on off; with it on, the node logs a warning.
  • sorryhyun Mod Guidance: with the default settings it can stop with a tensor-size error; turn on ref_in_uncond or ref_guidance_on.
  • SageAttention: with strength or weights β‰  1, the node uses PyTorch's fused attention for the reference part, so a GPU where Sage is much faster can be slightly slower there.

Known limitations

  • Faces with real artwork as the reference are slightly less close than with v1a (see the table).
  • Very small details (earrings, fine patterns, scars) can be simplified.
  • A scene can override the reference outfit (beach β†’ swimsuit). Raise strength or name the outfit.

Files

file
snapref_v2a_pre2.safetensors adapter, bf16 (382 MB)
snapref_v2a_pre2_fp8.safetensors adapter, FP8 (195 MB)
comfyui/snapref/ ComfyUI nodes: SnapRef (simple) and SnapRef (Advanced), for every SnapRef version
workflows/ simple (SnapRef node), single character, character mode, multi-reference, multi-reference with weights, two characters
training_config.json training config of the v2a run

License

The weights are a derivative of the CircleStone Model and are distributed under the CircleStone Labs Non-Commercial License v1.2 (LICENSE.md, NOTICE.txt). Non-commercial use only. Not affiliated with or endorsed by CircleStone Labs.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for 0ppxnhximxr/snapref-v2a-pre2

Adapter
(153)
this model

Collection including 0ppxnhximxr/snapref-v2a-pre2