-
Notifications
You must be signed in to change notification settings - Fork 41
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
WIP support for multiple concepts using filenames #22
base: main
Are you sure you want to change the base?
Conversation
this is a POC for testing what changes are needed to train for multiple concepts If your `instance_data` has filenames: "foo bar.jpg" -> "foo bar" "foo_bar.jpg" -> "foo bar" "foo bar-123.jpg" -> "foo bar" If you send `instance_prompt` it is prepended to the prompt from each filename
@@ -62,6 +62,10 @@ def predict( | |||
instance_prompt: str = Input( | |||
description="The prompt you use to describe your training images, in the format: `a [identifier] [class noun]`, where the `[identifier]` should be a rare token. Relatively short sequences with 1-3 letters work the best (e.g. `sks`, `xjy`). `[class noun]` is a coarse class descriptor of the subject (e.g. cat, dog, watch, etc.). For example, your `instance_prompt` can be: `a sks dog`, or with some extra description `a photo of a sks dog`. The trained model will learn to bind a unique identifier with your specific subject in the `instance_data`.", | |||
), | |||
instance_prompt_use_file: bool = Input( | |||
description="Whether to append to instance prompt from file.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by comment (I know this is a WIP):
Maybe include some examples here in the description to help illustrate the concept? This is effectively the documentation for this feature so it should be thorough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point.. it feels like using the blog to document all these features is getting complicated
It's like Everydream trainer to train multiple concepts? |
def extract_concept(fn): | ||
return fn.stem.replace("_", " ").split("-")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def extract_concept(fn): | |
return fn.stem.replace("_", " ").split("-")[0] | |
def extract_concept(filename): | |
return filename.stem.replace("_", " ").split("-")[0] |
Renaming to avoid confusion about fn
which is often used a shorthand for function
@anotherjesse aside from some docs tweaks, what more does this need to be shippable? |
Would be excited to see this PR land 🤩✨ |
@strickinato / other folks who want to try it out and give feedback: The In this case, I have pushed a version to my personal account: So to use this, follow along in the blog post, except specify
This prototype takes the If
|
Hey @anotherjesse I just tried training a new concept on top of an existing dreambooth model. The training was done surprisingly quickly but it has been stuck on "pushing" status since (been 30+ mins now). How do I troubleshoot this? |
I think the issue is you changed the This prototype doesn't support continuing training from an existing training session. this trainer allows you to send in multiple concepts. We will want to bring these trainers together as we understand them more. |
I followed the instructions and trained a model for a person and a style at the same time:
Limitations
Open questions
|
@ivan-volchenskov thanks for the great writeup & sharing your results! 30 minute timeoutYou are correct about timing out because it is under my personal account. Once we have a version in the replicate account, it will have the same 60 minute timeout as the other trainers. Your "open questions" highlight why this isn't yet on replicate's account. We need to ensure it both does what folks want - as well as document how to do so. How many concepts at once?Each image in your For instance you could make the
The question I don't know is how all this plays together. For instance I trained with two people by having
Then I used a single class_prompt of Multiple class names?That is a good question. perhaps we should support both multiple class names and parsing the class prompt from the filename similar to how it works for instances? Have you seen anywhere else training with multiple classes? |
Yes! Super helpful. |
I suppose you're right. There is one guy who has trained for seven of his styles. The only limitation is the training time, which in your case will be 60 minutes. If we take an average of 15 input images per concept, we will end up with 4-6 concepts, depending on how many class_images we want to generate.
There is an Automatic1111 plugin for the DreamBooth training. You can train up to 4 concepts with their web UI, but with their JSON option "you can theoretically use any number of concepts". Each concept parameters includes (among other things):
This means you can set a class name and training steps for each concept. |
Yes. Also, I've been testing this version for over 3 weeks and have occasionally gotten photos that look like your test ones with Zeke; I'm not sure if this version already includes the previous training or if it's a clean one. |
👻 |
Worked pretty well! My goal was the ability to train both a person and a piece of clothing. I've done a bit already with Automatic1111 (example here). I used the following parameters for the API:
And I followed the example pattern: If instance_prompt is "a photo of" and the your instance_data data.zip has filenames, it will use the image with the prompt: foo bar.jpg -> "a photo of foo bar" My file names were: I had 17 photos of the person and 13 photos of the sweater. Training person photo example: Training sweater photo example: prompt used for the following output:
Outcome: TODO I also want to look further into training a model on a clothing item, then inpainting it onto a photo (as shown in my Automatic1111 example). Thank you @anotherjesse!! |
this is a POC for testing what changes are needed to train for multiple concepts
If your
instance_data
has filenames:If you send
instance_prompt
it is prepended to the prompt from each filename