Skip to content

Commit 79a3248

Browse files
committed
Don't do 2-pass generation if the difference between resolutions is tiny
1 parent 1248529 commit 79a3248

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ai_diffusion/resolution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ def prepare_diffusion_input(
194194
desired, arch, style, inpaint
195195
)
196196

197-
if downscale and max_scale < 1 and any(x > max_size for x in desired):
198-
# Desired resolution is larger than the maximum size. Do 2 passes:
197+
if downscale and max_scale < 0.9 and any(x > max_size for x in desired):
198+
# Desired resolution is significantly larger than the maximum size. Do 2 passes:
199199
# first pass at checkpoint resolution, then upscale to desired resolution and refine.
200200
input = initial = (desired * max_scale).multiple_of(mult)
201201
desired = desired.multiple_of(mult)

tests/test_resolution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def test_inpaint_context(area, expected_extent, expected_crop: tuple[int, int] |
126126
"input,expected_initial,expected_desired",
127127
[
128128
(Extent(1536, 600), Extent(1008, 392), Extent(1536, 600)),
129-
(Extent(400, 1024), Extent(392, 1008), Extent(400, 1024)),
129+
(Extent(400, 1024), Extent(400, 1024), Extent(400, 1024)),
130130
(Extent(777, 999), Extent(560, 712), Extent(784, 1000)),
131131
],
132132
)

0 commit comments

Comments
 (0)