Skip to content

fix mel_spectrogram cache keys to include all config parameters#120

Open
zhuxiaoxuhit wants to merge 1 commit into
wenet-e2e:mainfrom
zhuxiaoxuhit:fix/mel-spectrogram-cache-keys
Open

fix mel_spectrogram cache keys to include all config parameters#120
zhuxiaoxuhit wants to merge 1 commit into
wenet-e2e:mainfrom
zhuxiaoxuhit:fix/mel-spectrogram-cache-keys

Conversation

@zhuxiaoxuhit
Copy link
Copy Markdown
Contributor

The mel_basis and hann_window caches in mel_spectrogram use incomplete keys:

  • mel_basis only keys on fmax + device, ignoring n_fft, num_mels, sampling_rate, fmin
  • hann_window only keys on device, ignoring win_size

Two concrete failure modes:

  1. A call with the same fmax but different num_mels silently returns the wrong mel filterbank.
  2. A call with a different win_size hits a cached window of the wrong length and crashes in torch.stft with "Expected a window of size N, but got M".

There's also a coupling bug: both caches were populated under a single mel_basis check, so changing fmax between calls could silently overwrite hann_window with a different win_size.

Fix: use fully qualified independent keys for each cache so different configurations don't interfere with each other.

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