Add in capability to repeatedly run the upscaler in a row #174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.