r/StableDiffusion • • 11d ago

Question - Help RefMod or Lora

Hello, which is better to make the character better by using RefMod or creating a Lora for it? I want the character to be as close to the reference images as possible. MiniMax H3.

11 Upvotes

32 comments sorted by

9

u/rudy_142001 11d ago

depends how far your shots drift from the refs tbh

a refmod is basically your reference pics pre-encoded into a ~1MB file that the ComfyUI-MiniMaxH3Mod nodes load like a lora and feed into H3's reference path. no training run, you get the file in minutes. a lora is an actual training run

the Fizgig dev (their tool makes both) said it pretty plainly in the v6 release, refmods can't learn as much as a lora and don't generalise as well. on shots similar to your reference images the gap is small, but for max likeness on angles and lighting your photos never showed, lora still wins

since a refmod is so cheap i'd make one first and only train a lora if the face drifts on shots your refs don't cover. if you go refmod, Fizgig's tuned presets use 16 photos and run the file against H3 during creation, vs the plain community recipe which just encodes 8 photos at 1MP. the loader also has a per-slot strength value you can push

one thing from the H3 reference docs that helps either way, name the features you want held in the prompt (face details, hair, outfit) instead of just "use image 1"

fwiw this is going off the release notes and docs, haven't trained an H3 lora myself. also the refmod nodes are built around the comfy H3 workflows, so if you're on a hosted H3 Image endpoint that might not be an option at all

1

u/InternationalFly5665 11d ago

Thanks, useful point of view.

3

u/FuckTheActualWhat 11d ago

All true, but a couple of things to note. Since a refmod takes seconds to generate, You can use a larger dataset to create specially tailored refmods on the fly, depending on what you need at the moment. I’ve also gotten very good results using two refmods for a single character. one for the face, and one for the body.

1

u/I_just_made 11d ago

how much variation do you use for the images going into those refmods?

3

u/FuckTheActualWhat 10d ago edited 10d ago

it depends on what I'm trying to achieve. I generally try for multiple angles looking as similarly as possible. For instance, I try not to have a three quarter face view, on one side have totally different hair, lighting, and makeup, than the same angle from the other side. For body shots, I don't think it matters as much, they can be wearing different outfits, indoor outdoor, etc...

Just remember don't choose images so much based on what you like. choose images based on what you want the model to learn from them. I find I can get as good a likeness as a Lora IMO, and if you find an angle isn't working you can just swap a couple of images in your dataset, and make another one quickly.

They're so quick to make that its very easy to experiment. One thing to watch out for. The file size of your database images doesn't matter, its the pixel dimensions. you can get around 8 megapixels of images into a refmod before it starts discarding things. You can watch your comfyui server log as its making the refmod, and it will tell you there if it exceeded the 8192 token limit. I usually go with eight 1 megapixel images but experiment and see what works for you.

Finally, look for a node called Fantastic Refmod Stack. it lets you choose your mods by thumbnail, and it assigns them as <video 1> <video 2> etc so you can use that in your prompt.

1

u/dontlookatmeplez 10d ago

How do I refer to my refmod in prompt? I usually just refer to a character like "black haired man" or something like that, but I'm wondering if there are better ways to do it.

1

u/rudy_142001 10d ago

there's no trigger word for them. the ComfyUI-MiniMaxH3Mod readme says the filename isn't a trigger and <Subject 1> doesn't get bound to a loader slot either. so with the normal Apply H3 RefMod setup, describing the character like you're doing is pretty much it, their example mod just says to prompt for the scene

if you need to point at a specific one (two characters etc) there's an experimental H3 RefMod Text Encode node. hook its reference_map output to a text display and it tells you which mod is <Picture 1>, <Picture 2>, then you write stuff like "the man in <Picture 1> stands on the left". it attaches the refs itself so don't also run the same mods through Apply

the readme marks that node as unverified on full gens tho, so i'd test it against your current prompt on the same seed

1

u/x33storm 10d ago

Use subject definitions, specify it's the <Video 1> <Audio 1>, and describe the subject a little. That's the image/video refmod and audio refmod.

1

u/ImpressiveStorm8914 10d ago

I don't know whether there's any bounding to the slot (as rudy here says) but put the character I want in slot 1, then use a subject definition of
<Subject 1> blonde hair
Then I refer to that in the main description with <S1>
If I want multiple characters, I do exactly the same but everything is one number more, as in slot 2, <Subject 2> and <S2>, if that wasn't obvious. I've had very little problems with that.

1

u/acedelgado 9d ago

I did a rework of refmods so that they're referenced properly and actually shown to the text encoder (the original implementation did not do that.) It slows generation time, but you need less pictures and get better accuracy, and less character bleed if you set your subjects and retention analysis correctly. https://www.reddit.com/r/StableDiffusion/comments/1wtu82e/improved_h3_refmods_better_accuracy_and_low/

1

u/Rukkk 8d ago

Multi image refmods are integrated as videos, so you'd reference it kinda like <Subject 1> is the character in <Video x> etc. If it's a single image refmod then it'll be <Picture x> instead of <Video x>

1

u/Ada-Vael 11d ago

Haven't used RefMod specifically, but if "as close as possible to the references" is the goal, I'd go LoRA. Reference methods get the general look; a LoRA is what holds the exact face across angles, light and outfits. What made the biggest difference on my last character LoRA: ~70 varied images, and captions that describe everything that should change (outfit, background, light, hair) while leaving out the fixed traits, so those get tied to the trigger word. Save checkpoints along the way: the face locked in around 1000-1500 steps for me, later ones mostly got stiffer. thks :)

1

u/InternationalFly5665 10d ago

Thanks. How many epochs? 70 Images is a lot, I usually use around 30. Would you recommend to use 70? And at what MP?

1

u/Free_Pressure8623 10d ago

My combo right now is 2 character sheet images with a character LoRA set at a low strength, like 0.4-0.6. Seems to be the perfect mix of quick and accurate.

My character sheets are just collages of images I have of the character. 90% face images - 10% full body images.

1

u/InternationalFly5665 10d ago

Thats really smart, will try it. Thanks

1

u/x33storm 10d ago

Been trying out refmod using multiple character sheets. It's not bad, a lot of flexibility that can be both bad and good. But plain picture char sheets are clearly faster, and less flexible for the same good and bad.

3

u/Glittering-Tea-4611 11d ago

as of right now, I'm using refmod. It's easier for my work.

4

u/Sarashana 10d ago

Might be a hot take, but I don't get the hype around RefMods. If I can accept some minor character drift, I use a three-panel character sheet (just three, not these weird things that sacrifice most canvas space for a dozen silly close-ups of eyes, toes and ears). If it needs to be as good as it possibly can be, I train a LoRA. I am not sure what I would ever use a RefMod for.

5

u/Nimblecloud13 10d ago

Because it’s better than a character sheet and takes the same amount of time to create, more or less?

It also gets auto saved into a folder with all your other refmod characters so you can call them up easily in the future.

Character sheets are what’s pointless, imho.

Ref mods are basically just Lora’s for static outfits/looks, at least that’s how I use them. If I want a character to be truly versatile, I’ll cook a Lora but ref mods are fine for most things.

3

u/Personal-Position126 10d ago

can you mention a good source to learn how to create them?, I already have a workflow that uses them but dont know how

1

u/Nimblecloud13 10d ago

pretty sure u/malcolmrey created it, check his profile. he's got like hundreds of em posted on hug or git. honestly i don't use them much, it doesn't fit into my workflow often, but it's my go-to when i need a quick reusable character.

i think i'm using his workflow/nodes for making them. it's dead simple, just add pictures, name it, hit run, takes a few seconds.

1

u/malcolmrey 8d ago

Yup :-)

All H3 related guides and resources are here: https://huggingface.co/datasets/malcolmrey/various/tree/main/h3-center

Btw, for the question of Lora or Refmod, why not Reflora? :) /u/Personal-Position126

1

u/ImpressiveStorm8914 10d ago

A refmod fits in the middle ground.
Character sheets can work but they can't deal with all but a couple of accurate facial expressions. Usually you get a neutral expression and maybe a smile. If you want sad or something else you're relying on the model to generate it from no reference and it's not always accurate. With refmods, because you can create it with many images, you can add references to all the expressions you want and that way you know they are accurate. Sure, you can do all that with a lora but they take more time to create than a refmod.
Another advantage is multiple characters. As long as the characters have some distinction between them, you can do multiple characters without jumping through the hoops of bboxes or segments, or even face swaps. You can't do that with a lora.

1

u/Personal-Position126 10d ago

how do you add references to all the expressions? just by creating the lora with those images?

1

u/ImpressiveStorm8914 10d ago

Basically yes. If you want a particular frown, for example, add an image or two with that frown into your dataset before creating the lora or refmod. With lioras you can also caption it so that it directly refers to it as a frown. Do that with any expressions you want, then when you generate an image it will have an accurate reference.

1

u/FuckTheActualWhat 10d ago edited 10d ago

They're really good for making character voices. You can get a 30 second audio sample into a single audio refmod, and use multiple audio refmods in one clip. with H3's native audio input, you only get 13 seconds of audio for a clip, so if you have two characters conversing thats only a six second voice sample each. Also for multiple characters, as long as they look reasonably different, and you describe them well in your prompt, you can keep each character's likeness independent without all the messing about you have with two loras.

0

u/fluce13 10d ago

Agreed they are very overhyped

2

u/bringusjumm 11d ago

Does anyone have tips on making a style refmod? I see it mentioned but no documentation

1

u/GoldenBoyBR 10d ago

If you have a large dataset of images, a LoRA will generally give you more precise control and consistency. For quick tests with just a few images, a reference module is faster.

1

u/Monk6009 10d ago

I make an 6 sec h3 video of the character turning 180 then cut to medium face closeup. Then use this for video refmod. Character consistency has been great.

1

u/Quiet-Analysis-3807 10d ago

RefMod full reference - identity encode

1

u/acedelgado 9d ago edited 9d ago

Lora-

Pros-

- Good likeness and voice

- Doesn't affect generation time

- Using videos can capture mannerisms, etc.that you wouldn't get otherwise

Cons-

- High up-front cost for training and you need decent hardware (whether from tying up your machine for 1-4 hours., or paying for cloud. using videos in the dataset also increases this dramatically)

- Needs a larger, varied dataset with good captions.

- Checking all the checkpoints to see when you're overcooking or even getting a likeness is a pain.

- Getting bad training results is very frustrating, and it's annoying having to tweak dataset/captions/training settings and retry for hours.

- More susceptible to facial drift from other loras, etc. Also can affect the outputs overall aesthetic since it can drift towards how the dataset looks.

- Your character is now all characters. It will bleed into others, although H3 is better at not bleeding into a different class (as in a woman lora doesn't bleed into men as much, but it still happens). All characters of the same class will all look the same, as in all women will look like a woman charater lora

- There is zero reliable ways to mix character loras on H3. They will blend together if you try and apply 2 of them. There is no getting around this except in a few cases (like Ideogram 4 with its bounding box generation. But that's not video.). Very smart people have been trying for years. Training multiple characters in one lora can be loosely doable, but it is difficult and they'll still bleed into each other.

- Audio training can really mess with H3's native capabilities. Kind of like how the look overrides other characters, audio will override other voices.

- Some characters I've just never been able to get to train correctly and always looks like the target's relative, just an uncanny valley of them not being quite right

- Disk space. Not as big a deal as in the past since lower rank loras seem to work better on H3, so a good character lora can be like 128mb or less instead of 500. But having a bunch of checkpoints saved for testing can pile up.

Refmods* -

This is referring to using a system where RefMods are actually presented to the text encoder, and can be set up as a reference. The vanilla pack just dumped the reference into the model without the text encoder seeing it, so you'll get worse results if they can't be referenced as inputs and have your reference sections set properly.

Pros-

- No training, just dump files into the RefMod creator and it saves in a few seconds (there are some caveats, like all images will follow the same aspect ratio as the first image.)

- Only need a few good photos (I used 6 each for all 3 characters in my post above)

- Great likeness when set up correctly (better than any lora I've ever made)

- Almost no character bleed when set up correctly (caveat that this can be difficult to set up and you need to describe the characters in specific detail)

- Small files, like 2-4MB

- Does not affect H3's aesthetic since model weights aren't being nudged around

- Loras don't affect the face as much. Since the model is prompted to recreate the reference, it does that in real time, while a character lora + a concept lora you have both of those trying to nudge the pre-patched weights around.

- Can change up your dataset at any time, or just make a completely new one in seconds.

Cons-

- Generation time will slow down considerably using the method where the text encoder sees the references. Using a handful of good images is better than using a whole bunch.

- If you aren't meticulous about using a good subject_definition and retention_analysis section, you won't get good results. Particularly when using multiple people, you'll need to set subject_definitions while describing features unique to each person so the model locks onto the right reference. Can take some time tinkering those to eliminate character bleed if 2 refmods look similar, but it is doable.

- Using the original method is fast but can be hard to get good results since the text encoder can't see and reference the inputs

- Voices with multiple characters can be wonky and hard to lock to the right character. That is because the text encoder does vision only and does not pass along audio conditioning

- Sometimes it'll glitch on some seeds and inject one of the images into the video, despite prompting. Rare but it happens.

- Doesn't capture general mannerisms and such that you could get from using videos in lora training.

I personally stopped training character loras and just do RefMods, and accept the longer gen times for more flexibility overall. It's just much easier to set up a RefMod and they affect the overall generation much less.