Fix mel length computation in Qwen2-Audio #42098
Open
+10
−4
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?
Qwen2AudioEncoder.forwardstating that "Qwen2Audio does not support masking of theinput_features", while in fact it does make use of it. This is likely a mistake made while copying the docstring over from Whispermax_mel_seq_lenis an odd numberHere's a more elaborate explanation for point 2:
max_seq_lenrepresents the maximum sequence length after the first 2 convolutional layers, of which only the first one compresses the input sequences (due tostride=2). The compression applied by the first convolutional layer can be computed using this expression (cf. torch.nn.Conv1d):which, given that:
padding= 1dilation= 1kernel_size= 3stride= 2can be simplified to:
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@ylacombe @amyeroberts @faychu