Support embedding models with vLLM backend#3016
Open
yuancu wants to merge 14 commits intodeepjavalibrary:masterfrom
Open
Support embedding models with vLLM backend#3016yuancu wants to merge 14 commits intodeepjavalibrary:masterfrom
yuancu wants to merge 14 commits intodeepjavalibrary:masterfrom
Conversation
EmbeddingCompletionRequest requires request_id field (no default).
- Remove unreachable text-generation branch in _map_task_to_runner_convert - Use self.vllm_properties.task instead of raw properties dict - Handle error HTTP status codes in embedding_output_formatter
Unit tests cover: output formatter (single/batch/error/dict/high-dim), task-to-runner/convert mapping (all task values), engine arg dict generation, preprocess_request embedding intercept, embedding detection logic, end-to-end inference flow, and DJL contract compliance. Integration test configs add e5-small-vllm and bge-base-vllm models.
Use option.normalize in serving.properties (default true) to control whether embedding results are L2-normalized before returning to clients. The value is passed through VllmRbProperties and applied in the output formatter via functools.partial.
- Add input validation for non-string/non-list inputs in embedding preprocessing - Add comment explaining normalize → use_activation mapping (vllm 0.19.x) - Make embedding_output_formatter signature explicit (request, tokenizer kwargs) - Rename RUNNER_VALUES/CONVERT_VALUES to lowercase (local variables, not constants) - Remove trivial TestEmbeddingDetection tests and stale formatter error tests
…ues only Remove dead options (reward, mm_encoder_only, pooling, draft, none) that vLLM does not accept as convert/runner args. Replace branching logic with a dict lookup of the 5 values users actually set.
f8d9f23 to
74a3074
Compare
…ion warnings - Handle non-200 responses and missing "data" field in embedding_output_formatter to avoid confusing KeyError crashes - Warn when passthrough engine args override computed runner/convert values - Replace deprecated asyncio.get_event_loop() with asyncio.run() in tests
Use text_embedding (and text-embedding alias) uniformly as the DJL embedding task for vLLM, consistent with other engines. Remove embed as a standalone task; text_embedding maps to vLLM's convert=embed internally. Update user guide and integration test configs accordingly.
20a9ff3 to
6661b85
Compare
Contributor
|
@yuancu Thanks for contributing! Could you run |
Author
|
@xyang16 Thanks for pointing out! Fixed |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR adds support of embedding models (e.g.
intfloat/e5-small) to vLLM backend through the vLLM handlerResolves #3015
Type of change
Checklist:
pytest tests.py -k "TestVllm1" -m "vllm"Feature/Issue validation/testing
Unit tests (27 tests in
test_vllm_embedding.py, 1 intest_properties_manager.py)use_activation, model name handling, empty/missing inputs, invalid type rejectionIntegration tests (e5-small-vllm, bge-base-vllm)
prepare.pyandclient.pywith batch sizes [1, 8]