Hello!
Here is the guide some people requested :-)
https://rentry.co/lycoris-and-lora-from-dreambooth
This is how I make my LyCORIS models.
The zip file that you can download contains the mp4 video tutorial part of the guide. You do not need to download it, it is also available online if you check the rentry page :)
EDIT: there is a second version called "Base Model in Diffusers" - this contains the exact model (based on RV2.0) that I use for my training.
Enjoy!
Description
FAQ
Comments (41)
Thank you so much for taking the time to create this for us. Can't wait to try it out. Give my thanks to Morgan too for his narration.
What is the reason all your models are using default "SKS PERSON" trigger word? Because of that it is not possible to use multiple models at once, as all have same trigger word. It was also proven to be bad trigger word itself. Please start using proper trigger words and change this in your tutorial so other people will not do the same mistake.
I wrote in the tutorial the reasoning about the sks and why it is no longer a bad token
you can even see it in the last section of the video: if it is not trained it indeed generates a person with a weapon, but when it is trained - the weapon does not appear at all, pretty much never
as for the other part, I've already written in another discussion about it, if you have hundreds of models it is much easier to have just one same token:
+ You don't have to memorize or write down unique tokens for each model (which becomes a problem if you have hundreds of them)
+ You can save your prompts with the token and you don't have to modify those prompts (for example, in the styles dropdown in A1111)
- you are right that it is not possible to use multiple people in the same generation, however, to use it properly you would need to train both concepts into a single model from the get-go, otherwise, they blend in (other people already mentioned that if you use LORAs that touch the same part of latent space then you may get weird results); in my opinion, it is much better to do the scene first with one model and then load the second model and use inpainting to fix the second character
"and change this in your tutorial" - this part I agree with, I could change from sks to zwx or what was the other famous token commonly used? had 4 letters and there was x somewhere, but can't remember it now
@WalterB anyway, I have decided to make a test, please pick one existing lycoris model of mine, I will retrain it with another token (`zwx` or one of your choosing)
then you (or other people) would make multi-people generations (without inpainting) to see what could even be made
if we see that those generations are easy to do, then perhaps I will change my mind about this :)
@malcolmrey your most downloaded lycoris right now is for Anya Taylor-Joy, so maybe try her, for the token, it doesn't need to be her name (though it will be easiest way, and could be stored as a model name as well) but something unique, so it will be possible to use with other unique tokens.
@WalterB good choice, i will retrain her over the weekend :-)
btw, quick question: someone on reddit mentioned that the main usage of mixing models is not to have two or more people but one person that is a mix of the used models - is that a thing for you as well?
the magician revealing his tricks, thank you!
thank you so much for your time and effort to put this together, will def. check it out!
Thank you so much!
what is the convolution dim? and how to decide it in terms with the network dim?
i've read in the docs that for LyCORIS the network should not exceed 64 otherwise there might be problems and the convolution dim should be less
this was by trial and error and 64/32 work rather well in this case
Thanks so much for sharing! This is an amazing guide. Great resources for tools as well!
The CaptureOne looks really convenient, however I'm hesitant to pay for it just for batch cropping images. It has a great advantage over BIRME though, being able to freely to crop a smaller part. That possibility is sadly still missing for BIRME as you are restricted to full width or full height selection of your image.
I looked around and found an alternative that you can host locally as well if desired. While you do not have all your pictures on one overview page you still can click through your bulk and crop however you like.
I uploaded a version hosted with python flask as local webserver: https://civitai.com/models/46364/web-bulk-image-cropper
Great at alway thanks malclom
i need some settings capture one app. consistent 512x512. how do you set the capture one application to lock at 512x512
you need to click on the export button and there you will have templates/settings for exporting, you edit one or create another to fixed width/size of 512 and make it active, you select not to upscale it
as long as that preset is the only one (or the first) selected then you will have the 512x512 selection box
also there you can select format (I pick png)
hey which is that tts ai in the video
it is the elevenlabs
i trained it on 5 minutes of morgan freeman speaking :)
Great thing, but missing esential steep of setup dreambooth and run it. Yes I know I complain, but this video greatly show and explain how collect data, not how train dreambooth itself.
Personally atm I have two option, blindly play with numbers via automatic1111 extension or fight with installing ubuntu on windows to have exactly what you use and then fingers cross to install overlay d8ahazard over installed DB and then fingers cross it will work after copy paste your rentry file.
Ps. voice over 11labs or there is "bark" that allows custom voice?
it was 11labs voiceover :)
as for dreambooth, I followed the nerdy rodent guide which I've linked, there would be no point in me redoing his steps when his guide was pretty much superb
if you follow his guide, you will have the same base of dreambooth as me, then just use the scripts with my parameters and you should be golden :)
-> fight with installing ubuntu on windows
to install ubuntu on windows is very simple, just select wsl2 from the Microsoft store and just install it (ubuntu is the default linux i believe)
-> then fingers cross to install overlay d8ahazard over installed DB
i do not use it so, can't really help you with that, but the improved version that I'm using was fairly easy to install
well, the whole process took me a weekend back then, but that pretty much is dreambooth for you
however the point of this tutorial was to showcase a different way to make lora/lycoris, starting from a dreambooth
Every time you learn something from Morgan Freeman, he gains a freckle
Thank you! You consistently put out great LoRAs, so it's nice to see your process!
I'm curious about how did you created the morgan voice and movements in the video. Thanks for the guide!
hey hey, i missed your comment somehow
I used eleven labs, provided 5 minutes of his voice and after a short moment I was able to use it :)
Great idea! So if I understand right you create a Dreambooth model and just extract the trained subject from it as LoRA or LyCoris.
If that is the case I can just train any model without all this complicated installing github scripts bla bla and just use NMKD GUI (single click dreambooth learning via Preset). But how the heck do I extract now my subject from a 7GB checkpoint file to make it a small LoRA/LyCoris? This step you skipped in the video. Thanks!
Yes indeed! That is what I do.
Well, it was mentioned briefly, because it is a small thing. All the scripts are pasted in the written guide.
To summarize it quickly: I use the kohakuBlueLeaf script "extract_locon.py"
For me the easiest way was to just install kohya_ss and use the same venv for the locon.
The example usage has all the parameters set the way I do it.
If you need some more help, just let me know :)
@malcolmrey okay thank you very much for clarification! That makes sense, you subtract the base model from the trained dbmodel to get the LoRA. I installed kohya_ss yesterday, but Im a bloody beginner. Just made my first standard LoRA yesterday - LOL. Does this method of training produce way better quality than using standard LoRA procedure with images and accompanied text files? Have to dig deeper into this subject. 👍
@technerd in my opinion - yes, this method is better
Nerdy Rodent made a nice test comparing quality of dreambooth and lora trainings: https://www.youtube.com/watch?v=gw2XQ8HKTAI
Turns out that dreambooth is better ( using same dataset )
Not sure what exactly, but extraction makes an improvement over that. Yes, it takes more time and needs more VRAM but training a model is a single action so it is worth spending a bit more time on that to achieve greater results :)
@malcolmrey how much vram you are using to make your dreambooth models?
@truefalse I have 11 GB VRAM and I use most of it
there is a setting to lower it to 8 but i never tried that one (also it says that it is at a cost of quality, allegedly)
@malcolmrey finally I made some more LoRA's from friends faces and they are "okay" but since you have much more experience I wanted to know. Which source model is better to use for LoRA training? "Stable Diffusion 1.5 base model" or any models from Civitai like Realistic Vision, Liberty, Analog Diffusion??? I know these are some basic questions but can't find any useful information about this on google.
@technerd "Technically" it shouldn't matter as we extract only what we've trained (in layman's terms) but it indeed matters what is used as a base model, judging from my experience
at the moment I use Realistic Vision 2.0 as a base and it serves me well.
previously I used my own model merge and it served me well, but RV is better so I switched
there are several great photorealistic models so if you find something that suits you best - you can that :-)
@malcolmrey i watched your video, read the rentry, watched nerdy rodent video and i didn't understand how to install it and how to use it, can you make a video for automatic1111 windows version?
@truefalse Im also a beginner (started 3 days ago with training stuff - LOL) but after watching this video I made my first LoRA's with kohya_ss that work. I have also A1111 but it's getting pretty chaotic to use with all the extensions installed.
Video on how to install kohya_ss and how to train your own LoRA's:
https://www.youtube.com/watch?v=9MT1n97ITaE
It has everything at one place for training anything. kohya_ss
Here: https://github.com/bmaltais/kohya_ss
Hope that helps.
@truefalse i'm not using that dreambooth version so it would be hard for me to do a video on it, however i can recommend Olivio's guide: https://www.youtube.com/watch?v=9Nu5tUl2zQw
He usually does it in a way that is great for everyone (advanced and beginners)
@malcolmrey Where exactly do you put or execute the kohakuBlueLeaf script for extracting a Lycoris file? I installed Kohya_ss. Do you go to the kohya_ss folder , type cmd , and execute it from here? Do you also have to install something from https://github.com/KohakuBlueleaf/LyCORIS ?
@semafor good question, this might be something I should put (expand) in my guide. But for now, I'll write here. Yes, it is like you said.
I installed kohya_ss (the requirements.txt file)
As a second step, I open the kohya_ss venv with this command: .\venv\Scripts\activate
and then i go one directory higher and I git clone the kohakuBlueLeaf lycoris repo, still being in the venv of kohya. I go inside that new LYCORIS folder and I run it its requirements.txt which is very small (i think only one thing is installed? the rest already is in kohya_ss)
And then I run the script.
You could install it separately but I did not want to duplicate the venv with the same stuff, and since it is advertised as kohya extension I figured it would work on the same versions of those python libs and it does.
@malcolmrey Could you write a precise step by step tutorial only for converting a dreambooth checkpoint to lycoris?
What I could understand are these steps:
1. I Installed kohya_ss under windows with the command:
git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
.\setup.bat
It is running and i successfully created a lora.
What and where is the requirements.txt file for kohya_ss? Do I need it?
2. I go to my kohya_ss root directory (It's G:\kohya_ss) and type cmd.
Is this what you mean with "open the kohya_ss venv"?
I assume I do not go to the venv directory.
Then I type .\venv\Scripts\activate
3. Could you help with the Change directory commands?
I want to install the kohakuBlueLeaf lycoris repo in G:\kohakuBlueLeaf
It is one directory higher and in a new folder.
Is it "cd .." and then "cd kohakuBlueLeaf" ?
4. when arrived In G:\kohakuBlueLeaf still in the same command window from step 2. I type:
git clone https://github.com/KohakuBlueleaf/LyCORIS
5. then i change the directory with "cd lycoris"?
What do I have to do exactly to run it its requirements.txt? to install this one thing you mentioned. Is it a command?
6. still in the lycoris directory i type the script (then with my directories):
python extract_locon.py --safetensors --device=cuda --mode="fixed" --linear_dim=64 --conv_dim=32 C:/Development/StableDiffusion/stable-diffusion-webui/models/Stable-diffusion/realisticVisionV20_v20.ckpt F:/Development/StableDiffusion/SDModels/Models/2023-04-17/model_morgan_v1_realistic2_3000.ckpt C:/Development/StableDiffusion/stable-diffusion-webui/models/Stable-diffusion/locon/locon_morgan_v1_from_v1_64_32.safetensors
7. Next time, I want to convert to lycoris, I just do the activation command in step 2 , change directory to the lycoris directory and run the script?
Thanks a lot
@semafor hey hey
1. by requirements I meant this: https://github.com/bmaltais/kohya_ss/blob/master/requirements.txt
but you used the setup.bat and it already calls it in line 42 so no need to do anything without it anymore, you're good ( pip install --use-pep517 --upgrade -r requirements.txt)
2. exactly! after you run this: .\venv\Scripts\activate
you will see the (venv) before your path name, this means you're in the context now :)
steps 3 and 4 look good :-)
in step5, as long as you are still in that (venv) then you can just write: pip install -r requirements.txt
and it will install the remaining stuff needed (if there is something still needed at this point)
step 6 -> Almost all good, that script is in the subfolder tools so before running that script just do: "cd tools"
7. Exactly! :-)
but in order to not type everything all the time, it's better to do some batch files, for example, I have run-venv.bat with this content: .\venv\Scripts\activate
and go-lycoris.bat
for you, it should have this content: cd ../kohakuBlueLeaf/LyCORIS/tools
one thing to note, the script you pasted: python extract_locon.py --safetensors --device=cuda --mode="fixed" --linear_dim=64 --conv_dim=32 C:/Development/StableDiffusion/stable-diffusion-webui/models/Stable-diffusion/realisticVisionV20_v20.ckpt F:/Development/StableDiffusion/SDModels/Models/2023-04-17/model_morgan_v1_realistic2_3000.ckpt C:/Development/StableDiffusion/stable-diffusion-webui/models/Stable-diffusion/locon/locon_morgan_v1_from_v1_64_32.safetensors
-> You need to change some values there, first is a path to the base model, then is the path to the dreambooth model and third is the path to the output lycoris :)
(also I suggest putting that command into batch file so you can just run it and change the values )
@malcolmrey hi there, just to let you know. The new version of "bmaltais/kohya_ss GUI" has the option to extract "LyCORIS LoCON" already included under utilities. Don't need to install anything other than kohya_ss. Made my first LyCORIS (network dim 64 / conv dim 32 the rest on default) in a couple of seconds by extracting it from my finetuned Dreambooth model (Dreambooth model made with NMKD GUI and with the included Medium Preset) and it works amazingly well. And its only around 90mb in size. Wow! Thank you very much malcom!
@technerd wow, great for the tip!
i will inspect that over the weekend and i guess i will need to update the guide, thanks!
Interesting, but how do you use Lora to train a specific fetish, rather than a person's face? I've tried and it simply isn't working, and yes, I even made sure not to use the name of said model when tagging each individual image.
I've had some success with that, but please let me know more details what do you have in mind?
For specific stuff like that, I change the class of course, it is no longer "woman" or "person" but perhaps "pose" or "position".
You piqued my interest, so let's explore this idea further!
Details
Available On (1 platform)
Same model published on other platforms. May have additional downloads or version variants.
