Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,11 @@


def get_new_h_w(h, w, scale_factor=8):
new_h = h // scale_factor**2
if h % scale_factor**2 != 0:
new_h += 1
new_w = w // scale_factor**2
if w % scale_factor**2 != 0:
new_w += 1
return new_h * scale_factor, new_w * scale_factor
# Optimize: cache scale_factor^2 and use fast "integer ceil division"
sf2 = scale_factor * scale_factor
new_h = -(-h // sf2) * scale_factor
new_w = -(-w // sf2) * scale_factor
return new_h, new_w


class KandinskyPipeline(DiffusionPipeline):
Expand Down