#Bunch of copy (differential) LoRA

143 messages · Page 1 of 1 (latest)

daring geyser
#

https://huggingface.co/Aotsuyu/LoRA/tree/main/diffLora
These are trained in an unique way. I first generated the Reimu image, trained a LoRA on it to the point it's overfit and only outputs the image, regardless of prompt (32/16 alpha/dim, adamw8bit 5e-4, 3 epochs, 300 steps, 1 batch size).
I then edit the image with a variety of effects I could think of, let's take the second one as the example, the wide one.
I train a similar lora on that image, and then I merge the two LoRA at -1 and 1 strength, while resizing to 8dim.
Doing this pretty much removes the Reimu from this merged lora, so you're left with a LoRA that applies the effect.
The effect isn't something amazing that you can't achieve without the LoRA usually, yes, but I've been having fun mixing these and hope to see more usage out of this method.
A more detailed comparison can be seen in the schizo grids directory, so I just post a relatively small grid here.
Previews generated with Aurora.
91 lora at the time of writing, some are admittedly pretty garbage (as in, they dont do anything that interesting), since I'm just throwing shit at the wall.

#

A more involved example, this is how I edited the reimu doing style transfer on Van Gogh's Starry Night

#

Ending up with a LoRA that does this

#

Interesting thing is that these also have sometimes great effects at strengths that we don't usually use, that being anywhere from -2 to 2 strength, sometimes even bigger values.

#

chalkandcharcoal effect

#

If nothing else, these can be used for meme LoRA (not quite sure why did the example turn out so lewd but it does showcase the effect)

#

This one has additional lora but it's something I liked, the invert lora made her a glowie

daring geyser
#

https://rentry.co/kopiki_lora Is where I got this method from, thank you @atomic goblet for posting it -w-

void spire
#

So you basically only use 2 images for each lora?

#

Or rather 1 for each and then merge them?

daring geyser
#

yep

#

so for these I used 1 image for the base lora and 1 each for the others so.. 92 images for 91 lora

#

my settings are probably not perfect either, it might be beneficial to actually train at some giga dim like 256

#

to make the overfitness overfit even more

#

because the more overfit it will be the less overfit the result will be... if that makes sense

#

basically you want to approach 0 loss with training

#

the values I posted should be good for a test run though, since it should take like 15 minutes to make the resulting lora

wheat fossil
daring geyser
#

do try out some of these, they are great

void spire
#

Cool stuff, gotta try making some KoishiSip

daring geyser
#

I theorize it could also be used for stuff like accurately generating tattoos for a character

#

or different pupil shapes, with pretty much no style impact

#

maybe even stuff like genning a fucked up hand with the 'v' gesture

#

fixing that

#

and doing the diff

#

suffice to say, there's potential

#

so far my attempts at tatto have failed tho

void spire
#

Could be potential for inpainting lora, the ones I've made are basically just overtrained

daring geyser
#

that was what I was thinking as well, since making an inpainting lora is usually a pain

daring geyser
#

ah I forgot to mention

#

in my repo the

#

shit named with just numbers

#

are random gens I used

#

5,6,7 can be interesting

#

and the psycho ones are just different color vomit patterns

vital solar
daring geyser
robust grove
noble dirge
wanton pecan
daring geyser
#

so I did some tests on spiral eyes, and I regret training at 512, I think that was the issue

#

I can try doing it on 876 tonight, I think I can do that on batch size 1

#

my initial edit kinda sucked as well I guess

#

lemme try and g enerate a cowboy shot xy and then I'll upscale one of these with adding @_@ tag

#

also I cba to try these out with inpainting right now

#

also I tried different settings for this one, ones I've seen iroiro use

#

which is 5k repeats, 1 epoch, 128 dim 64 alpha

#

1e-4

#

cosine

#

took a fair bit longer to make than my previous settings

wanton pecan
daring geyser
#

wdym 5 files

#

lemme redo

#

first try, lora 1.5 strength, cowboy shot, @@ in prompt, adetailer off
second, same settings, adetailer on, denoising 0.45, `@@, pink eyes in adetailer prompt
third, portrait, adetailer off
4th, portrait, adetailer on

#

then

#

5th, og generated without lora or adetailer (still had @_@ in prompt to not fuck the seed up),
6th, 5th but manually selected and inpainted (512x512, pink eyes, @@ in prompt, inpaint only masked, 0.8 denoising, lora at 1.8 strength)
7th, 5th but 1024x1536, 1girl, portrait, pink eyes, @@`, inpaint whole, 0.5 denoise, 1.5 lora strength

#

so it aint really amazing for inpaint

#

the portrait one generated as-is could be good at proper strength maybe

#

@void spire you may be interested in results

void spire
#

Did you try inpainting?

daring geyser
#

yesh, the second set is that

void spire
#

Curious to see how consistent it is

daring geyser
#

it seems to generate some bullshit with inpaint masked

void spire
daring geyser
#

this was trained on a portrait though

#

lemme find the set

#

as you can see the edit is kinda meh

#

it could be better at #1 trained at higher res

#

and #2 different crop of the eye

#

I did up the current ver to da repo

#

but it's not really in a usable state

void spire
#

Hmm hmm interesting

woven oak
#

this is interesting

vital solar
cold hemlock
#

@daring geyser Not sure if you are still looking at this thread - but I'm quite intrigued. I wanted to test this myself but I haven't had much luck, maybe you can point me in the right direction.

The rentry you linked seemed to need more steps and follow a more annoying process - so I followed you formula instead. I'll repeat it here and you can maybe let me know where I went wrong.

  1. I generate an image using a model (ie. dreamshaper)
  2. I train a lora on that image (dreamshaper as a base) to the point where it becomes overfit and only produces that image. This becomes loraA
  3. I modify the original image and train a second lora on the modified image (drameshaper as a base) to the point where it, again, becomes overfit and only produces that image. Exactly the same settings as the previous model. This becomes loraB
  4. I merge both loras (I'm using kohya_ss GUI) together without a base model, just the two loras. loraB with a weight of 1 and loraA with a weight of -1. This becomes loraC.

Is this process right? I ended up with a loraC that is also overfit and generates a more mangled version of the original image.

daring geyser
#

down to the lora seed

cold hemlock
#

yes, the lora seed was 123 for both. The images they produce don't look identical to each other (except for the mods) but they are very close. I'm not sure how busy you are but if you have a couple of minutes I can dm you and share some of what I'm seeing so that I don't spam this thread 🙂

daring geyser
#

also it could be the merge + resize that's not working well, I use python .\networks\svd_merge_lora.py --save_precision "fp16" --precision "float" --save_to "new8dimLoRA.safetensors" --ratios -1 1 --device "cuda" --new_rank 8 --models .\LORAofBASEIMAGE.safetensors .\LORAofEDITEDIMAGE.safetensors from command line

#

I mean it's no spam, really, since some people might learn from it down the road

#

but my DMs are open if you prefer that

cold hemlock
#

maybe I should give that a shot first. I'm using bmaltais' gui for kohya's scripts so I'm not the most familiar with the CLI interface for kohya's scripts, but I can give it a quick shot.

#

I had to edit his GUI so that it'd allow me to go to -1 on the merge weight and maybe that gets clamped elsewhere 🤔

daring geyser
#

well this one is also doing a resize to 8dim so that affects stuff but since bmaltais is just a wrapper for the scripts

#

there shoul be a 'sd-scripts' folder in there

#

if you go in there with a terminal and do .\venv\Scripts\activate this will activate the virtual environment that should just allow you to run the command I posted previously

#

with values adjusted to your lora names

#

okay I took a glance at the bmaltais repo and there's no sd-scripts folder, but you can do it from the 'base' folder

#

as in just .\venv\Scripts\activate and then the lora merge command

cold hemlock
#

tyty, merging it now 🙂

#

ok that works perfectly now @daring geyser -- I'll dig into what the difference is with what I was doing with bmaltais' wrapper and post it here in case it's helpful to others.
It might be the resize, but I don't know why that'd make a diff 🤔
EDIT: Not resize - most likely svd merge like mentioned below

void spire
#

just gonna chime in here, I tried doing with with #1073837013758902355 and that didn't work either.

daring geyser
#

bmaltais is probably using the normal merge_lora script and this one uses svd_merge_lora, what's the difference? no clue

#

SVD is basically a matrix factorization technique, which decomposes any matrix into 3 generic and familiar matrices.

wanton pecan
#

when the

daring geyser
#

I just realized I have probably made a big blunder by training the tenc even though there were no tags

#

manually setting text encoder weight to 0 yields usually better results with most

#

now I wonder if that can yeet the tenc somehow

daring geyser
#

toolkit can do it

vital solar
#

Yep yep

daring geyser
#

I ripped out the tenc so it's only natural that I post a grid

vital solar
#

315mb ReisenBlank

daring geyser
vital solar
daring geyser
surreal stump
#

Looking at these has made me realize I'm not creative, I just want to copy other people's artstyles

daring geyser
surreal stump
#

Yeah but I'm too brainlet to put them together to make somethign unique

daring geyser
#

at least some of them have some usage in horror

sullen rock
#

Who decides what is creative?

#

Arent you making something new out of something old?

mossy vector
daring geyser
mossy vector
woven oak
void spire
#

@slender briar Is it possible to do this with your trainer? I tried using your old sd scripts but couldn't get it working, maybe I'm missing something.

daring geyser
void spire
daring geyser
#

I use the script directly, yeah

void spire
#

Ye

#

Would be neat if there was an option for it in derrians trainer for convenience momi

slender briar
#

I can probably set it up, been busy mainly with keeping up with sdxl

slender briar
daring geyser
#

well I'm not sure how you'd implement it, I guess it'd be handling the svd merge script?

#

there was a way to differential train with kohya directly but I haven't tried it yet

#

that'd need specifying some additional args

slender briar
#

Ah yeah LECO right? It's not as precise as doing it this way is

slender briar