Skip to content

Conversation

tjohnson31415
Copy link
Contributor

@tjohnson31415 tjohnson31415 commented Mar 26, 2025

Removes padding of dummy encoder data. Instead, expect get_and_validate_mm_inputs to provide the max-size dummy sequence.

For Mllama, this additional padding would create an encoder input that was longer than expected leading to an AssertionError during profiling unless seq_len was small enough (see #13929).

FIX #13929

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added the multi-modality Related to multi-modality (#4194) label Mar 26, 2025
@tjohnson31415
Copy link
Contributor Author

My focus was on Mllama here. I'm not sure if the padding might be necessary for other models... Let me know if there other models that I should verify working with this change.

@tjohnson31415 tjohnson31415 changed the title [Bugfix] Do not pad encoder sequence dummy data [Bugfix] Do not pad multi-modal encoder sequence dummy data Mar 26, 2025
@DarkLight1337 DarkLight1337 requested a review from Isotr0py March 27, 2025 02:07
@DarkLight1337
Copy link
Member

The only other model we need to check is Whisper.

Comment on lines -192 to -198
# For encoder-decoder models, use encoder prompt token ids instead of
# decoder prompt to construct dummy seq_data for encoder profiling.
encoder_prompt_token_ids = mm_inputs["encoder_prompt_token_ids"]

total_len = len(encoder_prompt_token_ids)
num_tokens_to_pad = max(total_len, seq_len) - total_len
encoder_prompt_token_ids.extend([0] * num_tokens_to_pad)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I add this padding because whisper needs padding the encoder sequence. We need to update whisper's profiler to keep padding for it.

Copy link
Contributor Author

@tjohnson31415 tjohnson31415 Mar 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm starting to look at whisper now; trying out openai/whisper-small. I added some debug logs to this funtion and it looks like encoder_prompt_token_ids always comes in with a length of 1500 during the profiling and this padding doesn't usually trigger. Default for max multimodal batched tokens is 5120, so would need max_num_seqs<4 for seq_len to be >1500, but I get CUDA OOB exceptions if I try with max_num_seqs<12 🤔

Copy link

mergify bot commented Apr 1, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @tjohnson31415.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Apr 1, 2025
@DarkLight1337
Copy link
Member

Closing as superseded by #16129

@tjohnson31415 tjohnson31415 deleted the fix-encoder-dummy-data branch April 11, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multi-modality Related to multi-modality (#4194) needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: mllama AssertionError during kv cache profiling

3 participants