Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastvideo/models/audio/ltx2_audio_vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ def forward(self, y: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
y = y.unsqueeze(1)
left_pad = max(0, self.win_length - self.hop_length)
y = F.pad(y, (left_pad, 0))
spec = F.conv1d(y, self.forward_basis, stride=self.hop_length, padding=0)
spec = F.conv1d(y, self.forward_basis.to(y.dtype), stride=self.hop_length, padding=0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using self.forward_basis.to(y) is more robust than self.forward_basis.to(y.dtype) because it automatically matches both the device and the data type of y. This prevents potential runtime errors due to device mismatches if y and self.forward_basis happen to be on different devices.

Suggested change
spec = F.conv1d(y, self.forward_basis.to(y.dtype), stride=self.hop_length, padding=0)
spec = F.conv1d(y, self.forward_basis.to(y), stride=self.hop_length, padding=0)

n_freqs = spec.shape[1] // 2
real, imag = spec[:, :n_freqs], spec[:, n_freqs:]
magnitude = torch.sqrt(real**2 + imag**2)
Expand Down
Loading