Skip to content

[V1][Pixtral-HF] Add custom slice_encoder_output for Pixtral #13080

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

Closed
wants to merge 34 commits into from

Conversation

lk-chen
Copy link
Collaborator

@lk-chen lk-chen commented Feb 11, 2025

Prepare for #11409

This PR allows model to override _gather_encoder_outputs logic. Models like Pixtral need to take special tokens (break/end token) into consideration while gathering soft tokens.

See this comment for more context.

Test

Tested by running

VLLM_USE_V1=1 python examples/offline_inference/vision_language.py --model pixtral_hf --num-prompts=2

with #11409 patched, results are the same as V0.


cc @WoosukKwon @comaniac @ywang96

Linkun Chen and others added 30 commits November 18, 2024 05:52
* confirm that `offline_inference_vision_language.py` and `benchmark_throughput.py` runs
* FIXME: the placeholders in output, however, is empty
 - will fix in next commit

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
* add test for pixtral
* fix a typo

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Woosuk Kwon <woosuk.kwon@berkeley.edu>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
…ect#10383)

Signed-off-by: youkaichao <youkaichao@gmail.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
…odels (vllm-project#10374)

Signed-off-by: Roger Wang <ywang@roblox.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Chendi Xue <chendi.xue@intel.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
…ject#10394)

Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: youkaichao <youkaichao@gmail.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Kunshang Ji <kunshang.ji@intel.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
…ject#10403)

Signed-off-by: imkero <kerorek@outlook.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
vllm-project#10392)

Signed-off-by: wchen61 <wchen61@foxmail.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Cyrus Leung <tlleungac@connect.ust.hk>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
…m-project#10327)

Signed-off-by: Isotr0py <2037008807@qq.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
…vllm-project#10375)

Signed-off-by: Hollow Man <hollowman@opensuse.org>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
… optional argument

also require it to be passed as kwargs, to avoid breaking existing code.

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
… optional argument

also require it to be passed as kwargs, to avoid breaking existing code.

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
… optional argument

also require it to be passed as kwargs, to avoid breaking existing code.

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
mypy is not smart enough to validate kwargs

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
mypy is not smart enough to validate kwargs

Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
Signed-off-by: Linkun Chen <lkchen+anyscale@github.com>
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 v1 label Feb 11, 2025
Prepare for vllm-project#11409

For pixtral model, we need to insert placeholders in the middle of
encoder output, to fit into whole soft embedding. This case makes
slicing operation tricky. This PR raises assertion if something's
off.

Signed-off-by: Linkun Chen <github@lkchen.net>
Signed-off-by: Linkun Chen <github@lkchen.net>
@ywang96 ywang96 self-assigned this Feb 12, 2025
@DarkLight1337
Copy link
Member

DarkLight1337 commented Feb 12, 2025

For your reference, I have added a mapping from encoder outputs to embeddings in the outputs of Molmo multi-modal processor (#12966, see feat_is_patch and embed_is_patch) so that there is no need to define a custom hook inside the model. Do you think it's feasible to do the same for this model?

@lk-chen lk-chen marked this pull request as draft March 5, 2025 21:31
@lk-chen
Copy link
Collaborator Author

lk-chen commented Mar 6, 2025

Closing in favor of #14275

@lk-chen lk-chen closed this Mar 6, 2025
@lk-chen lk-chen deleted the pixtral_hf branch April 29, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.