Sign In

HOW TO: Prevent LoRA bleed using SDXL/Pony/Illustrious

32
HOW TO: Prevent LoRA bleed using SDXL/Pony/Illustrious

If you clicked on this article, you probably know what "LoRA bleeding" is. If not, that's great! Because I was going to explain it anyway!

When you apply a LoRA to a generated image, by default, that LoRA's training will change your entire image. So, for instance, if you want to make a picture of the Arbiter (she's a good example since she likes to share her fancy winged helmet with anyone around her).

Here's the Arbiter with a simple prompt of: 1girl, winged helmet <lora:Arbiter_XL_v2:0.8>

Not too bad for "1 chick with a winged hat", but what if I gave her a friend to play with?

The image below isn't exactly the "bleeding" I'd expected, but it work well enough for an "an he fly example". I added what I used to think would make two characters in the image, but as you see, it just "smooshed them" into a single character. - LoRAs also bleed into passerbys or crowds, but the idea's the same regardless. Here'ss the extened prompt, that, IMO should have created 2 characters:

highest detail, wide angle lens, view from above, 3rd party perspective, medium zoom, medieval city background, busy city street, vendors and merchants peddle their wares in the streets, crowds gather at their stalls, 2girls, two adult lovers reunited after years apart, a beautiful woman and her lovely girlfriend embrace in the middle of a busy city street, the Arbiter and StormyMeadows embrace holding each other closely, looking deeply into each other's eyes, public display of affection, townspeople barter for goods and services, couple's portrait, 2girls, 1girl with red hair and winged helmet, 1girl with black hair in a long twintails hairstyle <lora:Arbiter_XL_v2:1>

That's not what I mentioned in my prompt!! WTF!? Naw - Most models assume you only want a single character. It's not their fault, it's just the way they were trained.

The way to get around this in the past was to use the BREAK keyword, and it still works for most models!

Here's the prompt with the BREAK keyword used to separate a global prompt from individual prompts and the "\n" or newline (<ENTER>, ASCII code 13, whatever floats you want to call it) used to separate characters):

highest detail, wide angle lens, view from above, 3rd party perspective, medium zoom, medieval city background, busy city street, vendors and merchants peddle their wares in the streets, crowds gather at their stalls, 2girls, two adult lovers reunited after years apart, a beautiful woman and her lovely girlfriend embrace in the middle of a busy city street, the Arbiter and StormyMeadows embrace holding each other closely, looking deeply into each other's eyes, public display of affection, townspeople barter for goods and services, couple's portrait BREAK

2girls, the Arbiter, with red hair and a winged helmet,

2girls, StormyMeadows, black hair in a long twintails hairstyle <lora:Arbiter_XL_v2:1>

So that was enough to separate the one character into two characters, but where did the Arbiter's helmet go? It's still there... kind of, and the arbiter doesn't wear her hair in twintails! StormyMeadows does!

So you might think, :Lemme add a LoRA for character #2 as well, that should fix things up!"

Well - here's what happens when another LoRA is added (remember, LoRAs act globally by default):

highest detail, wide angle lens, view from above, 3rd party perspective, medium zoom, medieval city background, busy city street, vendors and merchants peddle their wares in the streets, crowds gather at their stalls, 2girls, two adult lovers reunited after years apart, a beautiful woman and her lovely girlfriend embrace in the middle of a busy city street, the Arbiter and StormyMeadows embrace holding each other closely, looking deeply into each other's eyes, public display of affection, townspeople barter for goods and services, couple's portrait BREAK

2girls, the Arbiter, with red hair and a winged helmet,

2girls, StormyMeadows, black hair in a long twintails hairstyle <lora:Arbiter_XL_v2:1> <lora:Prog_Stormy_Illustrious:1>

Again, not a bad image, but some thigs aren't quite right... The Arbiter is supposed to have red hair and wear a helmet, but StormyMeadows (the lady with black hair) has stolen the Arbiter's helmet and styled the Arbiter's hair to make it just like hers! The Audacity!!!

So if you were to continue to render the prompt above, you'd eventually get the correct combination to make both characters have their corresponding physical attributes, but there are a couple of ways we can improve the odds that our image comes out correctly:

#1: ControlNet. This tool is especially helpful for letting the base model know how many people it should represent in a generated image. S I added the image to ControlNet and used the below image as an example (this part is pretty great - it doesn't even have to be a good image, just one that you can count the individuals. Here' the image I used. It's crazy blurry (because I blurred it), but you can see there are two people hugging in it, and that's good enough. Here's a screenshot of ControlNet and the resulting generated image:

...and the result...

So the model on the right should have darker hair and they should be close to one another. Not a lot of change from the previous result, but every little bit helps.

IMPORTANT NOTE: lf, at this point, you're still getting results that only show one subject, increase the number of steps and CFG Scale values - I didn't have to send them through the roof for this image, but I've gone ass high ass 108 steps and a CFG scale of 15.

#2: Forge Couple/Regional Prompting. These tools are especially helpful when your characters keep raiding one another's wardrobes. I've written a couple of articles about Forge Couple that you can check out here: HOWTO: Multiple subjects using a Pony model (sd-webui-forge) &

Guide to Using Multiple Character Images with LoRas (stable-diffusion-webui-forge)

Regional prompting is effectively the same tool, it just works better with AUTO1111 if you're not yet using Forge or ComfyUI. If you are still using AUTO1111, consider switching interfaces as it is now "EOS" (no longer being updated except by the community).


I'm working on a dataset for a bounty @Ayanna_01 posted where duality is the topic. The character, Pito, is available in 3 flavors - original, spicy & extra-tasty crispy (they're all Pony, the LoRA style differs for each one though) it's also why I'm writing this article since OP mentioned, "Share Your Secrets: Upload the prompts you used for your submissions. Let’s inspire and learn from one another!" --@Ayanna_01

To keep me from having to post image results twice, I'll just pick up where I left off with those images since I'm using all the tools mentioned above in this dataset.

So, in a nutshell, the bounty is:

Show Her Duality: Submit at least two images showcasing both of Pito’s forms. (Also, I'd imagine using Ayanna_01's LoRAs would be fondly looked upon).

Character LORE:
Pito, a university student with perpetual eye bags and blonde hair, harbors the spirit of an ancient Goddess. When triggered, she transforms into a powerful, brown-haired deity capable of commanding the dead but at the risk of unleashing chaos. Despite her divine potential, Pito prefers her human life and strives to balance her normal existence with her violent alter ego. Her journey is one of self-discovery, seeking harmony between her ordinary struggles and extraordinary powers, becoming a symbol of inner strength and duality
Break down ( important notes )
Human Form: long blonde hair, grey eyes (traits: shy, introverted)
Goddess Form: Goddess Form, long brown hair, grey eyes (she also has goddess attire when transformed) (traits: extroverted, peak troller)

There were a couple of ways I could have taken that instruction, but I chose schizophrenia. Pito is going to be observing herself as if she existed in another external body. Her "goddess form" is supposed to have brown hair and is a violent troublemaker; her "OG form" has blonde hair, is a college student and is kin of the least interesting person in the world...

Given that, I wrote a prompt in which Pito would need to be present in both forms, one working as a webcam model (goddess form) and one spying on her (OG form).

Here's the prompt I am running with:

WARNING! TL;DR ALERT! I write long prompts:

realistic fantasy art, influenced by manga and hentai art, 2girls, visual novel about a young woman called Pito, 2panels, images side-by-side for comparison, before and after, 1 female college student with a vengeful goddess alter ego inside, duality, two personalities in one body, psychotic, mentally ill. Broadcasting live from their dorm room on Chaturbate.com, 2girl show, blonde and brunette, video still image, in the style of Naughty America, (nsfw:1.4), professional photography, full female nudity, sex workers BREAK
2panels, 2 girls, Pito, an ordinary American female college student that just moved out of her parent's house to live in an on-campus dormitory, an attractive young woman with long blonde wavy hair, curvy build, cold gray eyes, baggy oversized hooded sweatshirt, homely, bare legs, excited from her own touch, tiny black lace panties, barefoot, hanging out in her roommate's doorway watching her work, harbors the spirit of an ancient Goddess within her, visualises her other self as a whore sitting in front of her taking her top off for money, swooning, peeking out from behind a bedroom door, curious, pervy, watching her roommate take her bra off, hand between her lags, touching herself, aroused, female masturbation, masturbation through panties, peeksex, behind door.
<lora:Private_Pito:0.4><lora:Barely_Hidden_Sex:0.4> <lora:Private_Pito:0.1>
2panels, 2girls, Goddess Pito, an extraordinary otherworldly beautiful female goddess that possesses the body of a young American college student, naughty goddess, exhibitionist, sexy, elegant, curvy build, black lace bra and panties, , sex worker, showing off her medium breasts, holding bra, hands on bra, playful flirtatious smile, smoking a cigarette, webcam model, long dark brown wavy hair, stunningly beautiful, horny, longs for freedom from her dull alter ego roommate, laptop, webcam, glass dildo, bottle of Astroglide lubricant, working girl
<lora:Pito:0.6> <lora:BT_Holding_Stripped_Bra_Pony:0.4>

NOTE: I don't recommend using 5 LoRAs in a prompt like I did for this one. For every LoRA added, less and less of your entered prompt makes a difference... If you notice your characters aren't doing what's in your prompt - try lowering your LoRA weights or remove some of them completely.

And I set up my Forge Cople regions based on my line breaks in the prompt:

Now this is not the first time I've done this with this dataset - my original image generated was this one... Fairly close and I believe my regions were set up about the same way, but both versions used Forge Couple to keep goddess Pito & OG Pito from blending together since they both have different LoRAs associated with them. Now I'm going to run a batch through an Illustrious model instead of the Pony model I was using before The characters SHOULD remain separate and have very little LoRa bleed since I followed my own instructions:

Looks like there was a little bit of LoRA bleed in #3 & #5 is kinda creepy, but for TXT2IMG, they're fairly spot on. You can use this same method in IMG2IMG once you've generated an image that loosely resembles what you were going for. When you todd IMG2IMG in the mis with ControlNet, line breaks in your prompt & Forge Couple - you'll get very consistent results.

I plan to switch the focus of the images in my next batch so that the "goddess Pito" is observing "OG Pito", but that'll have to wait for another day!

I hope this was helpful to someone, an I'll append the final steps once I've finished them!

If you made it this far,,, Thanks for reading! If you have any other helpful methods for image creation, please let me know what they are!! Thanks again!

32

Comments