Skip to content

Conversation

maxdebayser
Copy link
Contributor

@maxdebayser maxdebayser commented Apr 7, 2025

This PR proposes an implementation path to support embedding models in V1. The basic idea is to take a different path than in V0 where there were completely different code bases for decoder models and encoder only models. Since the difference between decoder and encoder only models boils down to the attention mask and what is done to the hidden states at the end, in this PR I'm trying to add the minimum amount of changes required to the engine, the scheduler and the model runner to get embeddings working end-to-end.

In the current shape if this PR, Bert models are already running. The next steps are to enable the other embedding models in our unit tests.

The goal of this PR is to get V1 in a shape from where we can refactor the code base towards the a generic hidden states processor implementation: #12249

cc: @DarkLight1337

FIX #18052

maxdebayser and others added 7 commits March 24, 2025 15:59
Encoder-only models can also benefit from the prefix caching that is
enabled by the kv cache

Signed-off-by: Max de Bayser <[email protected]>
This is only passing mypy, it hasn't been tested
yet

Signed-off-by: Max de Bayser <[email protected]>
... and disable cuda graphs for these models.

Signed-off-by: Max de Bayser <[email protected]>
Copy link

github-actions bot commented Apr 7, 2025

👋 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 v1 tpu Related to Google TPUs labels Apr 7, 2025
Copy link

mergify bot commented Apr 7, 2025

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

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 7, 2025
Signed-off-by: Max de Bayser <[email protected]>
Signed-off-by: Max de Bayser <[email protected]>
Signed-off-by: Max de Bayser <[email protected]>
Signed-off-by: Max de Bayser <[email protected]>
Copy link
Member

@DarkLight1337 DarkLight1337 left a comment

Choose a reason for hiding this comment

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

I'm done with my initial review. Will test later. Can @njhill @robertgshaw2-redhat also take a look at this?

@mergify mergify bot added the frontend label Apr 8, 2025
@mergify mergify bot removed the needs-rebase label Apr 8, 2025
Signed-off-by: Max de Bayser <[email protected]>
@mergify mergify bot added the qwen Related to Qwen models label Jun 18, 2025
@WoosukKwon WoosukKwon merged commit 799397e into vllm-project:main Jun 19, 2025
63 of 67 checks passed
@DarkLight1337
Copy link
Member

Thanks for your hard work! Can you update the V1 guide with the latest status?

@maxdebayser
Copy link
Contributor Author

Thanks @DarkLight1337 and @22quinn for all your help. Is the doc update by @22quinn ok for now?

Comment on lines -1352 to -1356
# No Embedding Models so far.
if model_config.task not in ["generate"]:
_raise_or_fallback(feature_name=f"--task {model_config.task}",
recommend_to_remove=False)
return False
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to enable all tasks here?

TaskOption = Literal["auto", "generate", "embedding", "embed", "classify",
                     "score", "reward", "transcription"]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll double check the "transcription" task, but the others yes. Is this causing a problem?

Copy link
Member

Choose a reason for hiding this comment

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

Nope, it just caused a conflcit in my branch where I had enabled "transcription" and thought maybe it had enabled more than you intended. It's fine if you mean to!

I'm not sure about transcription, either. I know it wouldn't work with whisper, but that'll still get blocked because the model is marked as v0-only. Since all models should have the V0-only marker where needed, this check probably isn't necessary.

@DarkLight1337
Copy link
Member

Thanks @DarkLight1337 and @22quinn for all your help. Is the doc update by @22quinn ok for now?

Yeah it looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation frontend qwen Related to Qwen models ready ONLY add when PR is ready to merge/full CI is needed structured-output tpu Related to Google TPUs v1
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[RFC]: Support pooling in V1
9 participants