-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Kohya fix to SD pipeline for high resolution generation #7633
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
Conversation
Thanks for this PR @sajadn ! This is very helpful. |
thanks! can we move this to community folder? |
You mean moving the new pipeline to examples/community folder? how about unet_2d_condition_high_res? |
it can go into the same file :) |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
gentle pin :) |
Hey, |
thanks so much for the contribution!! |
@sajadn I've run your code, but the Fix doesn't seem to work. with_high_res_fix = True image.save(f"{prompt.replace(' ', '_')}_fix={with_high_res_fix}.jpg") But here's the results Am i do wrong? |
I think you're expecting too much of this, most of the examples I see aren't that great and yours seems like most of the examples, probably you need to keep re-rolling until you get a good seed. |
@Depfek6 I'd say play with the parameters. Decrease the scale_factor further to something like 0.25 or decrease the timestep to 500, you should be able to reduce the number of dog heads to one :D |
add kohya high resolution fix.
What does this PR do?
Adds Kohya fix to Stable Diffusion pipeline. Fixes #7265.
To Test?
Here is a minimal example to test the pipeline. You can disable the fix by setting with_high_res_fix to False which passes None to the pipline as high_res_fix argument.
high_res_fix argument is supposed to be a list of dictionaries where each element has three values of timestep, scale_factor, and block_num. For example, you can pass a high_res_fix of
[{'timestep': 900, 'scale_factor': 0.4, 'block_num': 2}, {'timestep': 600, 'scale_factor': 0.5, 'block_num': 1}]
.I find the default value of
[{'timestep': 600, 'scale_factor': 0.5, 'block_num': 1}]
to work well enough, but the user can modify based on their use-case.Here are some examples with a resolution of 1000x1600:

Prompt = "a dog sitting on the couch"
without the fix:
with the fix:

Prompt = "a pig sitting behind the desk"

without the fix:
with the fix:

Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@yiyixuxu @sayakpaul