-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Support runwayML custom inpainting model #1243
Conversation
This is still a work in progress but seems functional. It supports inpainting, txt2img and img2img on the ddim and k* samplers (plms still needs work, but I know what to do). To test this, get the file `sd-v1-5-inpainting.ckpt' from https://huggingface.co/runwayml/stable-diffusion-inpainting and place it at `models/ldm/stable-diffusion-v1/sd-v1-5-inpainting.ckpt` Launch invoke.py with --model inpainting-1.5 and proceed as usual. Caveats: 1. The inpainting model takes about 800 Mb more memory than the standard 1.5 model. This model will not work on 4 GB cards. 2. The inpainting model is temperamental. It wants you to describe the entire scene and not just the masked area to replace. So if you want to replace the parrot on a man's shoulder with a crow, the prompt "crow" may fail. Try "man with a crow on shoulder" instead. The symptom of a failed inpainting is that the area will be erased and replaced with background. 3. This has not been tested well. Please report bugs.
- The plms sampler now works with custom inpainting model - Quashed bug that was causing generation on normal models to fail (oops!) - Can now generate non-square images with custom inpainting model
- The plms sampler now works with custom inpainting model - Quashed bug that was causing generation on normal models to fail (oops!) - Can now generate non-square images with custom inpainting model Credits for advice and assistance during porting: @Any-Winter-4079 (http://github.com/any-winter-4079) @db3000 (Danny Beer http://github.com/db3000)
I'll test after class. Thanks! |
@Any-Winter-4079 The changes that you are seeing in the 1.4 model might actually be due to an unrelated PR I worked on a couple of days ago and merged last night (I'll have to look it up). Appallingly enough, it turned out that when you surround the prompt with quotation marks ("), the quotes were being passed to the generation engine. So "an anime girl" and an anime girl without the quotes, could give different results! You might want to try the comparison without quotation marks in the prompts. |
This model is very intriguing. Even in straight Outpainting, which I tested with the |
It seems to produce the same result with an without "" for me. |
So you're seeing differences using the 1.4 model between the PR and the pre-PR code base? I'll check it out on my own end. There were a bunch of fiddly changes, but hope I didn't inadvertently change the noise generation part of the code, which would most likely cause this. |
Yes, but I pulled other changes (not just this PR). Let me know if you can reproduce it, so we know it's not something on my end. |
There are so many variations of parameters that it has hard to do an apples-to-apples comparison. One conclusion that I've reached is that the strength option ( |
The above results are using the same parameters, including seeds, strength, source images, masks, etc. Everything is the same except for the model. I'll try with strength 0.99 and keep testing. Results with 1.5-inpainting:
Strength (
For starters, removing the hair seems to work much better than using clipseg (the hair is more blond!). But other than that, the strength value is ignored, as the results are the same.
Does |
Oh, by the way. When using I'm not sure how to do this now that 1.5 inpainting is the main model.
Yeah, not sure how could I have done it. It probably was Dreambooth .ckpt + regular img2img on that model. |
I’ve done img2img slightly wrong. I’m going to remove some code that over constrains the image. This should give us more variability. The strength parameter is inappropriate for this model and will be disabled. Sorry for the confusion, but it’s taken me some time to realize how the pieces fit together. |
1.5-inpaint after 906dafe Using mask: Using clipseg: btw I don't see clipseg in the output: |
This PR will break both I will fix these before marking the PR as ready for merging. |
No much of a difference between yesterday and today. What happens to your test image when you raise -C modestly to anything between 10.0 and 15.0? |
Using 1.5 inpaint and 906dafe |
I'm doing a small experiment with 20 images comparing yesterday's vs. today's code version, using single-word prompts && img2img. Update: Yesterday'sToday'sIt looks like it happens to both code versions (about 10% of the time).
About this, I've never even set up embiggen so I couldn't tell. This might be a good excuse to do so. |
- change default model back to 1.4 - remove --fnformat from canonicalized dream prompt arguments (not needed for image reproducibility) - add -tm to canonicalized dream prompt arguments (definitely needed for image reproducibility)
This was a difficult merge because both PR #1108 and #1243 made changes to obscure parts of the diffusion code. - prompt weighting, merging and cross-attention working - cross-attention does not work with runwayML inpainting model, but weighting and merging are tested and working - CLI command parsing code rewritten in order to get embedded quotes right - --hires now works with runwayML inpainting - --embiggen does not work with runwayML and will give an error - Added an --invert option to invert masks applied to inpainting - Updated documentation
Inpaint using the runwayML custom inpainting model
This is still a work in progress but seems functional. It supports inpainting, txt2img and img2img on the ddim, plms and k* samplers.
Installation
To test this, get the file
sd-v1-5-inpainting.ckpt
from https://huggingface.co/runwayml/stable-diffusion-inpainting and place it atmodels/ldm/stable-diffusion-v1/sd-v1-5-inpainting.ckpt
Usage
Launch invoke.py with
--model inpainting-1.5
and proceed as usual. All the usual arguments and settings should work (but haven't been systematically tested)Caveats