-
Notifications
You must be signed in to change notification settings - Fork 120
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
Possible to support img_callback and alternating prompts? #17
Comments
Hi @zwishenzug , Thank you for the greatly valuable suggestions!
Thank you for the suggestion. This argument is important for some downstream tasks such as image inpainting (e.g., adding masks at each step). I've supported it in the newest version of DPM-Solver and provided an example code with stable-diffusion. The corresponding argument is
This feature is strange to me because it actually changes the diffusion ODE at each step. Could you please give me some examples/motivations for why we need it? Thank you! |
Thanks for responding.
Thanks, I understand now, and can see how I can use At the beginning of
This is a much less intrusive way to resolve my issue while remaining compatible with the DDIM/PLMS samplers
These examples from the AUTOMATIC1111 user interface should give some insight to what people are doing with this. https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Features#prompt-editing It's correct that the target is being changed on each step. Sometimes this can have some interesting effects. For example, if you change between "Photo of Barack Obama" and "Photo of Donald Trump" on alternating steps, it may be that you get a result which is somewhat a mix of the two people. Or in the other example, if you start off with "a male military officer" for the first half of the process, then switch to "a female military officer" half way through, you may get a more masculine woman as a result. |
I've been able to get this working for my local version, I'm only concerned with classifier-free and multistep so it wasn't too hard it seems. It seems to be a case of modifying Then making the code lookup the cond/ucond in the list via step modulo
And making sure that the current step gets passed through from the main multistep code. I will need to do some proper testing, but it seems to be working okay so far in my limited testing. |
Hi @zwishenzug , Yes, I suppose it is the easiest way to add the And now I understand the feature of cycling prompts. I will try to figure out a more general API for supporting this as soon as possible. Thank you for the examples! |
Thank you for your hard work. I do have another question, is it possible to support the img2img function of stable diffusion? I can see that you have implemented stochastic_encode() but scripts/img2img.py also requires a decode() function, and I haven't been able to understand how to implement it myself. Thanks |
No problem. I will support it soon. |
I've come back to this because today I realised that actually it's
Just leaving a note in case anyone else is implementing it for themselves. |
Hi, thanks for making your code work with Stable Diffusion.
I have a couple of requests if possible.
Supporting the img_callback function allows us to render the current state every N frames. I'm using multistep and found adding code like this after multistep_dpm_solver_update works.
For example, I may have three seperate prompts, A, B, C
On Step 1, A is used
On Step 2, B is used
On Step 3, C is used
On Step 4, A is used
.... and so on, cycling through the list of prompts/conds
This is one of the workarounds people use to get around the 75/77 token limit for both cond and ucond.
This is what my code looks like in the ddim sampler, as you can see I essentially do x_cond = cond[step % len(cond)] to find which cond in the list to use on each step.
Thanks
The text was updated successfully, but these errors were encountered: