d8ahazard / sd_dreambooth_extension

Other
1.87k stars 283 forks source link

Use txt2img for regularization image generation #355

Closed dali99 closed 1 year ago

dali99 commented 1 year ago

WHAT Instead of reimplementing txt2img for regularization it'd be nice if this could be outsourced to txt2img directly.

WHY On my system the speed difference is huge (and has always been), with the dreambooth extension doing ~10s/it and txt2img doing ~5it/s (50x faster!)

ALTERNATIVES CONSIDERED Alternatively itd be possible to fix whatever causes the dreambooth extension to be slower But assuming the larger ecosystem can make speed improvements, itd be nice if that could be automatically leveraged

DOWNSIDES Even more linking to the chaos that is automatics webui Fancy settings elsewhere in the program might mess with the accuracy of the generated regularization output?

d8ahazard commented 1 year ago

This isn't really that tough to implement. Add a flag on "start training" that tells it whether to use the checkpoint for class gen, or the pipeline.

Only trick would be if the user created a model from huggingface hub, then I have no base checkpoint to load in the UI to use for txt2image. I could always generate a base checkpoint, but that's only good as long as it's not deleted.

And yes, of course, the massive headache that would probably result from trying to use txt2img if anything ever changed in the main app.

I've thought about it, but haven't come up with something elegant and future-proof to make me want to do this yet.

leppie commented 1 year ago

Tagging onto this, I tried to generate more classification images just now on an existing model with > 4000 steps and it just spat out images from the trained model. IMO, it should use the base model.

@d8ahazard can we also get a seed option for generating class images? I find it generates the same stuff if I delete unwanted ones.

leppie commented 1 year ago

On my system the speed difference is huge (and has always been), with the dreambooth extension doing ~10s/it and txt2img doing ~5it/s (50x faster!)

Quick hack (not as fast as txt2img), but you can set the class batch size higher (4 worked in my case). Then cancel after it generated the images. And revert to class batch size of 1 or whatever you use.

@d8ahazard maybe a class image generation batch size too?

d8ahazard commented 1 year ago

Class batch size only controls the speed of class image generation, fwiw. ;)

On Tue, Nov 29, 2022 at 3:52 PM Llewellyn Pritchard < @.***> wrote:

On my system the speed difference is huge (and has always been), with the dreambooth extension doing ~10s/it and txt2img doing ~5it/s (50x faster!)

Quick hack (not as fast as txt2img), but you can set the class batch size higher (4 worked in my case). Then cancel after it generated the images. And revert to class batch size of 1 or whatever you use.

— Reply to this email directly, view it on GitHub https://github.com/d8ahazard/sd_dreambooth_extension/issues/355#issuecomment-1331368523, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMO4NAKKCFMN62RPDNHA2LWKZ3IZANCNFSM6AAAAAASN3QAYI . You are receiving this because you commented.Message ID: @.***>

d8ahazard commented 1 year ago

Implemented with the latest release.