Skip to content

Fix VAE-aligned chunking in full-song inference - #5

Open
zonnart17-collab wants to merge 1 commit into
AMAAI-Lab:mainfrom
zonnart17-collab:fix/vae-aligned-fullsong-chunking
Open

Fix VAE-aligned chunking in full-song inference#5
zonnart17-collab wants to merge 1 commit into
AMAAI-Lab:mainfrom
zonnart17-collab:fix/vae-aligned-fullsong-chunking

Conversation

@zonnart17-collab

@zonnart17-collab zonnart17-collab commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Fix cumulative timing drift and padded output tails in both SonicMaster full-song inference paths.

  • centralize the published checkpoint geometry in fullsong_chunking.py;
  • use the loaded VAE's actual hop length with the trained 645-frame main sequence and 215-frame carry sequence;
  • apply the same geometry to infer_single.py and inference_fullsong.py;
  • keep duration conditioning fixed at the trained value of 30 seconds;
  • validate VAE sample rate, model sequence length, main encode, decode, and carry geometry at runtime;
  • trim the final padded tail to the exact input length without allowing trim to hide stitched underflow.

infer_single.py no longer exposes --fs, --chunk_duration, or --overlap_duration. Input audio is resampled to the published checkpoint sample rate of 44.1 kHz.

Background

The previous 30-second waveform chunk contained 1,323,000 samples at 44.1 kHz, but the Oobleck VAE encodes it to 645 frames and decodes those frames to 1,320,960 samples.

That 2,040-sample discrepancy accumulates at every stitched chunk boundary. The previous nominal 10-second overlap also used 441,000 samples instead of the VAE-native 215 × 2048 = 440,320 samples.

The corrected geometry is:

  • main: 645 × VAE hop = 1,320,960 samples;
  • carry: 215 × VAE hop = 440,320 samples;
  • stride: 880,640 samples;
  • trained duration conditioning: 30 seconds.

Validation

  • py_compile: passed
  • tests/test_fullsong_chunking.py: 11 tests passed
  • full-song multi-chunk inference preserves the exact resampled input length
  • main/carry geometry is 645/215 frames with zero cumulative boundary drift

No changes are made to model.py, model configuration, training, preencoding, latent batch inference, dataset generation, or evaluation code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant