fixing aspect ratio on hires

This commit is contained in:
tyler 2022-10-25 20:59:13 -05:00
parent 4104ac6270
commit 62412f8398

View File

@ -27,9 +27,8 @@ class Txt2Img2Img(Generator):
@torch.no_grad() @torch.no_grad()
def make_image(x_T): def make_image(x_T):
trained_square = 512 * 512 scale_dim = min(width, height)
actual_square = width * height scale = 512 / scale_dim
scale = math.sqrt(trained_square / actual_square)
init_width = math.ceil(scale * width / 64) * 64 init_width = math.ceil(scale * width / 64) * 64
init_height = math.ceil(scale * height / 64) * 64 init_height = math.ceil(scale * height / 64) * 64