From c2f9f56c9859f99ccdc2ff128209473dd6b06923 Mon Sep 17 00:00:00 2001 From: Bernard Tan <30761156+thkkk@users.noreply.github.com> Date: Thu, 9 Oct 2025 15:50:55 +0800 Subject: [PATCH] Added view(-1, 1) before expanding 1D tensors expand()only works on dimensions of size 1 --- wan/modules/model.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wan/modules/model.py b/wan/modules/model.py index 6982fa15..1c240ee6 100644 --- a/wan/modules/model.py +++ b/wan/modules/model.py @@ -458,6 +458,9 @@ def forward( # time embeddings if t.dim() == 1: + # Note: expand only works for dimensions of size 1; view(-1, 1) must be called first. + t = t.view(-1, 1).expand(t.size(0), seq_len) + elif t.dim() == 2 and t.size(1) == 1: t = t.expand(t.size(0), seq_len) with torch.amp.autocast('cuda', dtype=torch.float32): bt = t.size(0)