Skip to content

[bugfix] Fix STFT dtype mismatch - #1419

Merged
SolitaryThinker merged 1 commit into
mainfrom
klin/ltx23-fix
Jun 1, 2026
Merged

[bugfix] Fix STFT dtype mismatch#1419
SolitaryThinker merged 1 commit into
mainfrom
klin/ltx23-fix

Conversation

@kevin314

@kevin314 kevin314 commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • Fix STFT dtype mismatch for bf16 inference in LTX-2.3

Test Plan

# Commands you ran

Test Results

Test output
# Paste output here

Checklist

  • I ran pre-commit run --all-files and fixed all issues
  • I added or updated tests for my changes
  • I updated documentation if needed
  • I considered GPU memory impact of my changes

For model/pipeline changes, also check:

  • I verified SSIM regression tests pass
  • I updated the support matrix if adding a new model

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates the forward pass in ltx2_audio_vae.py to cast self.forward_basis to the data type of y before performing the 1D convolution. The reviewer suggested using self.forward_basis.to(y) instead of self.forward_basis.to(y.dtype) to ensure both the device and data type are matched, preventing potential device mismatch errors.

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)

@mergify mergify Bot added the scope: model Model architecture (DiTs, encoders, VAEs) label Jun 1, 2026
@mergify

mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

⚠️ PR title format required

Your PR title must start with a type tag in brackets. Examples:

  • [feat] Add new model support
  • [bugfix] Fix VAE tiling corruption
  • [refactor] Restructure training pipeline
  • [perf] Optimize attention kernel
  • [ci] Update test infrastructure
  • [infra] Add activation trace hooks
  • [docs] Add inference guide
  • [misc] Clean up configs
  • [new-model] Port Flux2 to FastVideo
  • [skill] Add add-model agent skill

Valid tags: feat, feature, bugfix, fix, refactor, perf, ci, infra, doc, docs, misc, chore, kernel, new-model, skill, skills

Please update your PR title and the merge protection check will pass automatically.

@mergify

mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 PR merge requirements

Waiting for

  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success~=pre-commit
This rule is failing.
  • #approved-reviews-by>=1
  • check-success=fastcheck-passed
  • check-success~=pre-commit
  • check-success=full-suite-passed
  • title~=(?i)^\[(feat|feature|bugfix|fix|refactor|perf|ci|doc|docs|misc|chore|kernel|new.?model|skill|skills|infra)\]

@kevin314 kevin314 changed the title Fix STFT dtype mismatch [bugfix] Fix STFT dtype mismatch Jun 1, 2026
@mergify

mergify Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Pre-commit checks failed

Hi @kevin314, the pre-commit checks have failed. To fix them locally:

# Install pre-commit if you haven't already
uv pip install pre-commit
pre-commit install

# Run all checks and auto-fix what's possible
pre-commit run --all-files

Common fixes:

  • yapf: yapf -i <file> (formatting)
  • ruff: ruff check --fix <file> (linting)
  • codespell: codespell --write-changes <file> (spelling)

After fixing, commit and push the changes. The checks will re-run automatically.

For future commits, pre-commit will run automatically on changed files before each commit.

@mergify mergify Bot added the type: bugfix Bug fix label Jun 1, 2026
@SolitaryThinker

Copy link
Copy Markdown
Collaborator

/merge

@github-actions github-actions Bot added the ready PR is ready to merge label Jun 1, 2026
@SolitaryThinker
SolitaryThinker merged commit 89fcf08 into main Jun 1, 2026
15 of 21 checks passed
@SolitaryThinker
SolitaryThinker deleted the klin/ltx23-fix branch June 1, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready PR is ready to merge scope: model Model architecture (DiTs, encoders, VAEs) type: bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants