You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enabling Oobleck VAE tiling can shorten the encoded audio. In a complete Stable Audio audio-to-audio call using small random-weight components, a 2,097,152-sample waveform produces 1,023 latent frames instead of 1,024. The pipeline then fails when adding the encoded audio to its noise tensor. Disabling tiling makes the same call succeed.
I was trying to generate a variation of an existing recording with Stable Audio and I enabled VAE tiling to reduce memory use
Logs
torch.Size([1, 3, 1024])
torch.Size([1, 3, 1023])
Expected: both encodings should produce 1,024 latent frames.
In StableAudioPipeline, the mismatch raises:
RuntimeError: The size of tensor a (1023) must match the size of tensor b (1024) at non-singleton dimension 2
System Info
Diffusers 0.44.0.dev0, main 750b3be2c0198e194c87e931a6904066de167a5f; Linux x86_64, Python 3.11.15, PyTorch 2.7.1+cpu, Transformers 5.23.0. Validated on CPU with random-weight components; pretrained audio quality and GPU execution were not tested.
Who can help?
@sayakpaul@sanchit-gandhi Would the maintainers be open to a focused fix aligning Oobleck's encoder tiles to its hop length? I'd be happy to contribute the fix if the approach is approved.
I’d like to work on this. I reproduced the 1024 → 1023 drop on CPU with the snippet above.
The cause is in AutoencoderOobleck._tiled_encode: the tile windows aren’t aligned to hop_length, and the hop is inferred from the first tile, so the rounded trims lose a frame at the join. I have a local fix that rounds tile_sample_min_length / tile_sample_overlap (and therefore the stride) down to multiples of hop_length, trims with the exact hop, and adds a model-level regression test with deliberately non-aligned tile sizes. Tiled encode now matches the unsplit 1024 frames.
Would maintainers be open to that approach? If @gorkadabo1 is already planning to submit this, I’m happy to defer.
Thanks for looking into this and for offering to defer! As mentioned in the issue, I've already prepared and validated a fix with tests, so I'd like to take this one forward myself. I'm waiting for maintainer approval before opening the PR.
@gorkadabo1
thanks for opening the issue
before we look into this, could you share an real use case example? e.g. a script generate correct audio but throw an error when tailing is enabled
Hi @yiyixuxu, I've attached a runnable reproduction script. On upstream, the audio-to-audio pipeline succeeds without tiling but fails with tiling enabled. Both cases pass with my proposed fix.
Activity
YidaWeng commentedon Nov 22, 2026
I’d like to work on this. I reproduced the 1024 → 1023 drop on CPU with the snippet above.
The cause is in
AutoencoderOobleck._tiled_encode: the tile windows aren’t aligned tohop_length, and the hop is inferred from the first tile, so the rounded trims lose a frame at the join. I have a local fix that roundstile_sample_min_length/tile_sample_overlap(and therefore the stride) down to multiples ofhop_length, trims with the exact hop, and adds a model-level regression test with deliberately non-aligned tile sizes. Tiled encode now matches the unsplit 1024 frames.Would maintainers be open to that approach? If @gorkadabo1 is already planning to submit this, I’m happy to defer.
gorkadabo1 commentedon Nov 22, 2026
Thanks for looking into this and for offering to defer! As mentioned in the issue, I've already prepared and validated a fix with tests, so I'd like to take this one forward myself. I'm waiting for maintainer approval before opening the PR.
yiyixuxu commentedon Nov 28, 2026
@gorkadabo1
thanks for opening the issue
before we look into this, could you share an real use case example? e.g. a script generate correct audio but throw an error when tailing is enabled
gorkadabo1 commentedon Nov 28, 2026
Hi @yiyixuxu, I've attached a runnable reproduction script. On upstream, the audio-to-audio pipeline succeeds without tiling but fails with tiling enabled. Both cases pass with my proposed fix.
reproduce_stable_audio.py
Fix Oobleck tiled encode dropping latent frames (huggingface#15376)