Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
dc77cb71
Unverified
Commit
dc77cb71
authored
Jan 09, 2026
by
Alex Brooks
Committed by
GitHub
Jan 09, 2026
Browse files
[Bugfix] Fix Var Length Batched Padding in Granite Speech (#31906)
Signed-off-by:
Alex-Brooks
<
Alex.Brooks@ibm.com
>
parent
bde38c11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
vllm/model_executor/models/granite_speech.py
vllm/model_executor/models/granite_speech.py
+8
-3
No files found.
vllm/model_executor/models/granite_speech.py
View file @
dc77cb71
...
@@ -672,7 +672,13 @@ class GraniteSpeechForConditionalGeneration(
...
@@ -672,7 +672,13 @@ class GraniteSpeechForConditionalGeneration(
else
:
else
:
# Otherwise we have a list of tensors, which are almost certainly
# Otherwise we have a list of tensors, which are almost certainly
# differing in their respective numbers of audio features;
# differing in their respective numbers of audio features; when
# passed as a batch, we expect a list of 2D var len input features
# so unsqueeze them.
input_features
=
[
feat
.
unsqueeze
(
dim
=
0
)
for
feat
in
input_features
if
feat
.
ndim
==
2
]
# stack them into a 3D tensor of size [bsz, most_num_features, 160].
# stack them into a 3D tensor of size [bsz, most_num_features, 160].
input_features
=
self
.
_pad_and_stack_input_features
(
input_features
=
self
.
_pad_and_stack_input_features
(
input_features
,
input_features
,
...
@@ -724,13 +730,12 @@ class GraniteSpeechForConditionalGeneration(
...
@@ -724,13 +730,12 @@ class GraniteSpeechForConditionalGeneration(
Args:
Args:
input_features: list[torch.Tensor]
input_features: list[torch.Tensor]
Input features to be coerced into a tensor.
3D
Input features to be coerced into a tensor.
Returns:
Returns:
torch.Tensor: Tensor of shape [bsz, num_features, 160], where
torch.Tensor: Tensor of shape [bsz, num_features, 160], where
num_features is the max number of features of any entry in the
num_features is the max number of features of any entry in the
batch.
batch.
"""
"""
# Input features are of shape [bsz, num_features, 160]
feat_lens
=
[
feats
.
shape
[
1
]
for
feats
in
input_features
]
feat_lens
=
[
feats
.
shape
[
1
]
for
feats
in
input_features
]
padding
=
[
max
(
feat_lens
)
-
length
for
length
in
feat_lens
]
padding
=
[
max
(
feat_lens
)
-
length
for
length
in
feat_lens
]
# TODO (Alex) - Validate that it's okay to zero pad like this;
# TODO (Alex) - Validate that it's okay to zero pad like this;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment