Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add padding to encoder_seq_lens #610

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions vllm/worker/hpu_enc_dec_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ def _prepare_encoder_model_input_tensors(
attn_metadata.cross_block_groups = block_groups
attn_metadata.cross_block_usage = block_usage

# add padding to align with language model shapes
real_batch_size = len(seq_group_metadata_list)
batch_size_padded = self.bucketing_ctx.get_padded_batch_size(
real_batch_size, is_prompt)
batch_size_padding = batch_size_padded - real_batch_size
if batch_size_padding > 0:
encoder_seq_lens.extend(encoder_seq_lens[0]
for _ in range(batch_size_padding))

encoder_seq_lens_tensor = self._list_to_int32_tensor(encoder_seq_lens)
attn_metadata.encoder_seq_lens = encoder_seq_lens
attn_metadata.encoder_seq_lens_tensor = encoder_seq_lens_tensor
Expand Down
Loading