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

Add in capability to repeatedly run the upscaler in a row #174

Merged
merged 4 commits into from
Feb 24, 2024

Conversation

sean-bailey
Copy link
Contributor

While the ESRGAN upscaler models compatible with stable-diffusion.cpp at this time are fixed in their upscaling rate, they do not discriminate on input image data. This means that, hypothetically, we could continuously run that upscaling model on the outputs of the previous upscaling run until we run out of memory.

I've tested this locally on my M1 MBP, and have successfully done txt2img and img2img generation resulting in image resolutions of 8192x8192. Bigger than that and I get an out-of-memory error, but hypothetically a large enough machine should be able to do this.

This does not affect the image upscale multiplier inherent to the model, it simply runs the same fixed-multiplier model repeatedly (so for example, an x4 model would take a 512x512 image upscaled to 2048x2048 on one pass, and then from 2048x2048 to 8192x8192 on a second pass, then 32k x 32k, then 128...)

The changes were designed to have minimal impact on any other code, so anything which currently leverages legacy versions should continue to function fine. If you want to use the new upscale repeating function, add

--upscale-repeats <int >= 1>

to your command. Otherwise, by default, it will default to run the upscaler once.

@leejet
Copy link
Owner

leejet commented Feb 24, 2024

Great! Thank you for your contribution.

@leejet leejet merged commit 193fb62 into leejet:master Feb 24, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

3 participants