From 05c6b49b901f85449c39359b2ea493922294b430 Mon Sep 17 00:00:00 2001 From: ziyannchen <1041276865@qq.com> Date: Wed, 16 Jul 2025 10:30:33 +0000 Subject: [PATCH 1/3] fix a bug in sliding_window inference --- diffsynth/pipelines/wan_video_new.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffsynth/pipelines/wan_video_new.py b/diffsynth/pipelines/wan_video_new.py index 9f52ddc..59b4690 100644 --- a/diffsynth/pipelines/wan_video_new.py +++ b/diffsynth/pipelines/wan_video_new.py @@ -1047,7 +1047,7 @@ class TemporalTiler_BCTHW: mask = self.build_mask( model_output, is_bound=(t == 0, t_ == T), - border_width=(sliding_window_size - sliding_window_stride,) + border_width=(sliding_window_size - sliding_window_stride + 1,) ).to(device=data_device, dtype=data_dtype) value[:, :, t: t_, :, :] += model_output * mask weight[:, :, t: t_, :, :] += mask From c05b1a2fd0ba27be6fe36c120b26a6f20d780107 Mon Sep 17 00:00:00 2001 From: ziyannchen <1041276865@qq.com> Date: Sun, 20 Jul 2025 11:13:20 +0000 Subject: [PATCH 2/3] fix a bug in sliding window inference --- diffsynth/pipelines/wan_video_new.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/diffsynth/pipelines/wan_video_new.py b/diffsynth/pipelines/wan_video_new.py index 59b4690..f1a4dfe 100644 --- a/diffsynth/pipelines/wan_video_new.py +++ b/diffsynth/pipelines/wan_video_new.py @@ -1012,12 +1012,16 @@ class TemporalTiler_BCTHW: def __init__(self): pass - def build_1d_mask(self, length, left_bound, right_bound, border_width): + def build_1d_mask(length, left_bound, right_bound, border_width): x = torch.ones((length,)) + if border_width == 0: + return x + + shift = 0.5 if not left_bound: - x[:border_width] = (torch.arange(border_width) + 1) / border_width + x[:border_width] = (torch.arange(border_width) + shift) / border_width if not right_bound: - x[-border_width:] = torch.flip((torch.arange(border_width) + 1) / border_width, dims=(0,)) + x[-border_width:] = torch.flip((torch.arange(border_width) + shift) / border_width, dims=(0,)) return x def build_mask(self, data, is_bound, border_width): @@ -1047,7 +1051,7 @@ class TemporalTiler_BCTHW: mask = self.build_mask( model_output, is_bound=(t == 0, t_ == T), - border_width=(sliding_window_size - sliding_window_stride + 1,) + border_width=(sliding_window_size - sliding_window_stride,) ).to(device=data_device, dtype=data_dtype) value[:, :, t: t_, :, :] += model_output * mask weight[:, :, t: t_, :, :] += mask From c125728ce03bd723e271f28cd8a92c2a0f16aa78 Mon Sep 17 00:00:00 2001 From: Artiprocher Date: Tue, 29 Jul 2025 11:16:50 +0800 Subject: [PATCH 3/3] bug fix --- diffsynth/pipelines/wan_video_new.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diffsynth/pipelines/wan_video_new.py b/diffsynth/pipelines/wan_video_new.py index f1a4dfe..80807dd 100644 --- a/diffsynth/pipelines/wan_video_new.py +++ b/diffsynth/pipelines/wan_video_new.py @@ -1012,7 +1012,7 @@ class TemporalTiler_BCTHW: def __init__(self): pass - def build_1d_mask(length, left_bound, right_bound, border_width): + def build_1d_mask(self, length, left_bound, right_bound, border_width): x = torch.ones((length,)) if border_width == 0: return x