Repository navigation
[llm] Upgrade vLLM to 0.31.0 #66720
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
Merged
Merged
[llm] Upgrade vLLM to 0.31.0 #66720
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| --- | ||
| myst: | ||
| html_meta: | ||
| description: "vLLM features reachable through Ray Serve LLM: embeddings, transcriptions, structured JSON output, and vision language models." | ||
| description: "vLLM features reachable through Ray Serve LLM: embeddings, transcriptions, structured JSON output, vision language models, and diffusion language models." | ||
| --- | ||
|
|
||
| (vllm-compatibility-guide)= | ||
|
|
@@ -16,7 +16,7 @@ This compatibility means you can: | |
| - Switch between `vllm serve` and Ray Serve LLM with no code changes and scale | ||
| - Use Ray Serve's production features such as autoscaling, multi-model serving, and advanced routing | ||
|
|
||
| This guide shows how to use vLLM features such as embeddings, structured output, vision language models, and reasoning models with Ray Serve. | ||
| This guide shows how to use vLLM features such as embeddings, structured output, vision language models, diffusion language models, and reasoning models with Ray Serve. | ||
|
|
||
| ## Embeddings | ||
|
|
||
|
|
@@ -357,6 +357,82 @@ for chunk in response: | |
|
|
||
| For a complete list of supported vision models, see the [vLLM multimodal models documentation](https://docs.vllm.ai/en/stable/models/supported_models/#list-of-multimodal-language-models). | ||
|
|
||
| ## Diffusion language models | ||
|
|
||
| Ray Serve LLM supports discrete diffusion models such as DiffusionGemma through vLLM. Set `diffusion_config` in the engine arguments and serve the model with {doc}`direct streaming <direct-streaming>`, so that per-request `vllm_xargs` reach the engine. | ||
|
|
||
| ### Deploy a diffusion model | ||
|
|
||
| ::::{tab-set} | ||
|
|
||
| :::{tab-item} Server | ||
| :sync: server | ||
|
|
||
| ```python | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a blocker to making this a doctest
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'll convert all code snippets in this page to doc tests in a follow-up |
||
| # Run with RAY_SERVE_ENABLE_HA_PROXY=1 and RAY_SERVE_LLM_ENABLE_DIRECT_STREAMING=1. | ||
| from ray import serve | ||
| from ray.serve.llm import LLMConfig, build_openai_app | ||
|
|
||
|
|
||
| # Configure a diffusion model | ||
| llm_config = LLMConfig( | ||
| model_loading_config=dict( | ||
| model_id="diffusiongemma", | ||
| model_source="google/diffusiongemma-26B-A4B-it", | ||
| ), | ||
| engine_kwargs=dict( | ||
| tensor_parallel_size=4, | ||
| max_model_len=8192, | ||
| diffusion_config=dict(canvas_length=64), | ||
| ), | ||
| ) | ||
|
|
||
| # Build and deploy the model | ||
| app = build_openai_app({"llm_configs": [llm_config]}) | ||
| serve.run(app, blocking=True) | ||
| ``` | ||
| ::: | ||
|
|
||
| :::{tab-item} Python Client | ||
| :sync: client | ||
|
|
||
| ```python | ||
| from openai import OpenAI | ||
|
|
||
| # Initialize client | ||
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="fake-key") | ||
|
|
||
| # Create and send a chat request | ||
| response = client.chat.completions.create( | ||
| model="diffusiongemma", | ||
| messages=[{"role": "user", "content": "Write a haiku about the ocean."}], | ||
| stream=True, | ||
| ) | ||
|
|
||
| for chunk in response: | ||
| if chunk.choices[0].delta.content is not None: | ||
| print(chunk.choices[0].delta.content, end="", flush=True) | ||
| ``` | ||
| ::: | ||
|
|
||
| :::{tab-item} cURL | ||
| :sync: curl | ||
|
|
||
| ```bash | ||
| curl http://localhost:8000/v1/chat/completions \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer fake-key" \ | ||
| -d '{ | ||
| "model": "diffusiongemma", | ||
| "messages": [{"role": "user", "content": "Write a haiku about the ocean."}] | ||
| }' | ||
| ``` | ||
| ::: | ||
|
|
||
| :::: | ||
|
|
||
| For structured reads and the request options they take, see vLLM's [structured diffusion example](https://github.com/vllm-project/vllm/tree/main/examples/features/structured_diffusion). | ||
|
|
||
| ## Reasoning models | ||
|
|
||
| Ray Serve LLM supports reasoning models such as DeepSeek-R1 and QwQ through vLLM. These models use extended thinking processes before generating final responses. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we move this to the Ray Serve LLM index docs page instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good given that lots of people are asking for it, will do in a separate PR