Skip to content

Commit

Permalink
fix(api): pad partial latents when working with tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jun 6, 2023
1 parent 2a16041 commit 6b1ce37
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/onnx_web/diffusers/utils.py
Expand Up @@ -272,7 +272,15 @@ def get_tile_latents(
xt = x + t
yt = y + t

return full_latents[:, :, y:yt, x:xt]
tile_latents = full_latents[:, :, y:yt, x:xt]

if tile_latents.shape[2] < t or tile_latents.shape[3] < t:
px = t - tile_latents.shape[3]
py = t - tile_latents.shape[2]

tile_latents = np.pad(tile_latents, ((0, 0), (0, 0), (0, py), (0, px)), mode="reflect")

return tile_latents


def get_scaled_latents(
Expand Down

0 comments on commit 6b1ce37

Please sign in to comment.