Conversation
…forward callable Both wrappers pass an argument list their own delegate cannot accept, so calling either module raises TypeError before any inference happens: * DiffWaveVocoder.forward(spectrogram) -> decode_batch(spectrogram), but DiffWaveVocoder.decode_batch requires hop_len (unlike HIFIGAN's, where hop_len is optional -- the wrapper looks copied from there). * PIQAudioInterpreter.forward(wavs, wav_lens) -> interpret_batch(wavs, wav_lens), but interpret_batch only takes wavs. Signed-off-by: Anai-Guo <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Two
Pretrainedwrappers inspeechbrain/inference/call their own delegatewith an argument list the delegate cannot accept, so
module(...)raisesTypeErrorbefore any inference happens. Both are one-line call-sitemismatches; I kept them in one PR because it is the same defect, but happy to
split if you prefer.
1.
DiffWaveVocoder.forward(speechbrain/inference/vocoders.py)DiffWaveVocoder.decode_batch(self, mel, hop_len, mel_lens=None, ...)makeshop_lenrequired — it is passed toself.infer(scale=hop_len, ...)and tomask_noise. The two sibling vocoders in the same file bind fine, which iswhat makes this one stand out:
HIFIGAN.decode_batch(self, spectrogram, mel_lens=None, hop_len=None)hashop_lenoptional, andUnitHIFIGAN.forwardforwardsspkexplicitly. The DiffWave wrapper lookscopied from
HIFIGAN.forwardwithout noticing that itsdecode_batchhas asecond required parameter.
Fix: take
hop_leninforwardand pass it through.2.
PIQAudioInterpreter.forward(speechbrain/inference/interpretability.py)interpret_batch(self, wavs)takes no lengths, and the class's owninterpret_filealready calls it asself.interpret_batch(batch). Thewav_lensparameter has therefore never reached anything — passing it (orleaving it at its default) fails identically, because it is forwarded
positionally either way.
Fix: drop the argument that has no receiver, so
forwardmatchesinterpret_batchandinterpret_file. I deliberately did not addwav_lenssupport tointerpret_batchinstead: the method does nolength-based masking anywhere, so adding an ignored parameter would just move
the silent-drop one level down.
Neither class is referenced anywhere else in the repo (
recipes/,tests/,templates/,docs/are all clean), and the docstring example ininterpretability.pyusesinterpret_file, so nothing that currently workschanges behaviour.
Fixes #<no issue — found by an arity sweep over
self.<method>(...)call sites>Verification
No model download or GPU needed. I replayed each
forward -> delegatecallsite against signatures parsed out of the real source with
inspect.Signature.bind, running the same harness overgit show HEAD:<file>and over the patched tree, and including the two sibling vocoders as a control:
Lint/format with the
ruffversion pinned in.pre-commit-config.yaml(
v0.12.4), run at the repo root:Before submitting
forwardsignatures)ruff+ the signature replay above; the affected classes have no tests)🤖 Generated with Claude Code