Skip to content

[SIGGRAPH Asia 2026] 4DAnyone: Create Anyone in 4D from a Casual Monocular Video

Release: reduce inference FFN peak memory (#27)

Yudong Jinf135b478ac29
diff --git a/fdanyone/vendor/diffsynth/models/wan_video_dit.py b/fdanyone/vendor/diffsynth/models/wan_video_dit.py
index 9dcb71f..2c083bb 100644
--- a/fdanyone/vendor/diffsynth/models/wan_video_dit.py
+++ b/fdanyone/vendor/diffsynth/models/wan_video_dit.py
@@ -300,6 +300,11 @@ class DiTBlock(nn.Module):
def _feed_forward(self, x: torch.Tensor) -> torch.Tensor:
hidden = self.ffn[0](x)
+ # ``x`` is the owned BF16 modulation result, not the block residual.
+ # Release it after the first projection so the allocator can reuse its
+ # token slab for the equally shaped second-projection output.
+ if not torch.is_grad_enabled():
+ del x
hidden = gelu_tanh(hidden)
return self.ffn[2](hidden)