Fix VAE pixel normalization in-place bug

This commit is contained in:
Daniel Maddern 2026-08-19 21:07:34 +07:00
parent 9bec53ac36
commit 390135fca6

View file

@ -256,7 +256,8 @@ class MiniMaxH3VideoVAEEncoder(nn.Module):
"""``[B,3,H,W]`` or ``[B,3,T,H,W]`` pixels in ``[-1, 1]`` -> normalized latents ``[B,24,T_lat,H//16,W//16]``.""" """``[B,3,H,W]`` or ``[B,3,T,H,W]`` pixels in ``[-1, 1]`` -> normalized latents ``[B,24,T_lat,H//16,W//16]``."""
if x.ndim == 4: if x.ndim == 4:
x = x.unsqueeze(2) x = x.unsqueeze(2)
x = x.add(1.0).mul_(0.5).sub_(self.pixel_mean.to(x)).div_(self.pixel_std.to(x)) x = (x + 1.0) * 0.5
x = (x - self.pixel_mean.to(x)) / self.pixel_std.to(x)
if x.shape[2] == 1: if x.shape[2] == 1:
moments = self._adaptive_encode(x)[:, :, -1:, :, :] moments = self._adaptive_encode(x)[:, :, -1:, :, :]
else: else: