Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Train multiple subjects in the same model #245

Open
CHJ85 opened this issue Jul 28, 2023 · 3 comments
Open

Train multiple subjects in the same model #245

CHJ85 opened this issue Jul 28, 2023 · 3 comments

Comments

@CHJ85
Copy link

CHJ85 commented Jul 28, 2023

Having the ability to train multiple subjects within the same model can be quite useful if you're using your model to create stories with multiple people and such.
As of now, the subject within the model is being triggered by one specific prompt that you type into the script.
But what if you gave the option to either set a specific trigger prompt (the current behavior) or use the image's filename as a prompt. For instance if you got a series of images called bob(0).png, bob(1).png, bob(2).png and so on, then those images will be trained to the trigger prompt "bob". Then you add a series of images of steve(0).png, steve(1).png, steve(2).png etc... Now you got 2 trigger prompts within the same model (bob and steve).
Would this be doable?
If this can be done, I think that'd make a great addition to the script.

@Sandeep-Narahari
Copy link

is there any script providing multiple subjects in the same model, please share me the reference if any , Thank you

@CHJ85
Copy link
Author

CHJ85 commented Sep 11, 2023

This one: https://github.com/TheLastBen/fast-stable-diffusion
You name your subjects like this "character1(0).png, character1(1).png, character1(2).png, character2(0).png, character2(1).png, character2(2).png", where the name of the image becomes the trigger prompt.
I've found a couple more that does this, but they're kinda half-ass at it and tend to just blend the characters together. This one does it right though.
This LoRA trainer also does a decent job with text files for each image specifying the characters / subjects:
https://github.com/hollowstrawberry/kohya-colab/blob/main/Lora_Trainer.ipynb

@chchchadzilla
Copy link

yall don't just copy/paste the concept .json code and fill in the blanks? That's what I do... I've trained 5 concepts on one ckpt before. only thing tht sucks is it takes forever for caching latents and if you're doing 1000 class img per 10 instance than you're going to be sitting a long time. and maybe running out of room in colab, which you can fix by just direct linking to your google drive paths, but, either way, you CAN train multiple concepts, just copy/paste the code that's there 3 or 4 times. You can't stop training early, or use early saves of it, because you'll be missing info since it'll have trained one concept more than the others-- so they all need the same amount of images, the same prompting, the same quality of images, and you gotta put your steps in multiples of however many class photos you have. for instance: if I have 4 concepts with 1000 class img each, I'm training the model in batches of 4000. After 4000, they're about even, and usually I'll have to go to 8000 steps with the learning rate turned way down so it doesn't overfit. but they come out really really nice. i have colab pro, as well as a 3090 that I use when I'm out of monthly compute units, tho, so, depending on your setup, it may not be a viable way to do things. but thought i'd share what works for me either way. cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants