From b9e4259cc474d50a0e5e74d5097068e97ba70708 Mon Sep 17 00:00:00 2001 From: "zhuguoxuan.zgx" Date: Wed, 1 Jul 2026 18:22:07 +0800 Subject: [PATCH] fix: correct qwen image tile mask weights --- .../models/qwen_image/autoencoder_kl_qwenimage.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/diffsynth_engine/models/qwen_image/autoencoder_kl_qwenimage.py b/diffsynth_engine/models/qwen_image/autoencoder_kl_qwenimage.py index 632f365e..e3d56a1a 100644 --- a/diffsynth_engine/models/qwen_image/autoencoder_kl_qwenimage.py +++ b/diffsynth_engine/models/qwen_image/autoencoder_kl_qwenimage.py @@ -1058,6 +1058,8 @@ def _build_tile_mask(self, tile, is_bound, border): """Build border weight mask for tile blending.""" _, _, _, h, w = tile.shape border_h, border_w = border + border_h = min(h, border_h) + border_w = min(w, border_w) is_top, is_bottom, is_left, is_right = is_bound mask = torch.ones(1, 1, 1, h, w, dtype=tile.dtype, device=tile.device) @@ -1068,7 +1070,7 @@ def _build_tile_mask(self, tile, is_bound, border): if not is_bottom and border_h > 0: for y in range(border_h): - mask[:, :, :, h - 1 - y, :] *= y / border_h + mask[:, :, :, h - border_h + y, :] *= 1 - y / border_h if not is_left and border_w > 0: for x in range(border_w): @@ -1076,7 +1078,7 @@ def _build_tile_mask(self, tile, is_bound, border): if not is_right and border_w > 0: for x in range(border_w): - mask[:, :, :, :, w - 1 - x] *= x / border_w + mask[:, :, :, :, w - border_w + x] *= 1 - x / border_w return mask