Repository navigation
[serve.llm] Score API Integration for Serve LLM - #55914
Conversation
Signed-off-by: ahao-anyscale <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request successfully integrates the vLLM Score API by adding a new /v1/score endpoint. The changes are well-structured and follow existing patterns in the codebase. I've provided a few suggestions to improve documentation clarity, type safety, and correctness. Specifically, I've recommended updating the documentation with a critical usage note, enhancing a validation method to be more explicit, and correcting a type hint in a method signature to include the new request type.
| def _validate_openai_serving_scores(self): | ||
| assert hasattr( | ||
| self._oai_serving_scores, "create_score" | ||
| ), "oai_serving_scores must have a create_score attribute" |
There was a problem hiding this comment.
To make this validation more robust and to allow removing the type: ignore in the score method, it's a good practice to explicitly check if self._oai_serving_scores is not None before checking for the attribute. This improves type safety and follows the pattern in _validate_openai_serving_models.
| def _validate_openai_serving_scores(self): | |
| assert hasattr( | |
| self._oai_serving_scores, "create_score" | |
| ), "oai_serving_scores must have a create_score attribute" | |
| def _validate_openai_serving_scores(self): | |
| assert self._oai_serving_scores is not None, "oai_serving_scores is not initialized" | |
| assert hasattr( | |
| self._oai_serving_scores, "create_score" | |
| ), "oai_serving_scores must have a create_score attribute" |
There was a problem hiding this comment.
Following existing format for validation function, none of the other ones include None checking
nrghosh
left a comment
There was a problem hiding this comment.
looks good, thanks for adding the tests / version check
| async def score(self, body: ScoreRequest) -> Response: | ||
| """Create scores for the provided text pairs. | ||
|
|
||
| Note: This is vLLM specific endpoint. vLLM v1 does not support score, must use v0. |
There was a problem hiding this comment.
Is the V1 incompatibility documented somewhere? (I was not able to easily verify this)
In parallel, @ahao-anyscale can you add a link to an issue requesting /score support in V1?
There was a problem hiding this comment.
+1 to creating issue -- and include the other custom APIs as well if they are not supported in V1. Separately, could be a good idea to create some serve issues/tickets to add support as well.
There was a problem hiding this comment.
When I try to run BAAI/bge-reranker-v2-m3 with v1, i get NotImplementedError: VLLM_USE_V1=1 is not supported with ['XLMRobertaForSequenceClassification', 'TransformersForCausalLM']. I wasn't able to find any concrete documentation about the score API itself.
There was a problem hiding this comment.
It appears that v1 just doesn't work with many scoring models but not all of them. I'll get rid of the checks.
https://docs.vllm.ai/en/v0.9.2/models/supported_models.html#sentence-pair-scoring
|
|
||
| def _create_raw_request( | ||
| self, | ||
| request: Union[CompletionRequest, ChatCompletionRequest, EmbeddingRequest], |
There was a problem hiding this comment.
I think we need to start using overload decorator for this function
| self, | ||
| *, | ||
| body: Union[CompletionRequest, ChatCompletionRequest, EmbeddingRequest], | ||
| body: Union[ |
There was a problem hiding this comment.
similarly let's use overload decorator for this method to avoid listing all the possible combinations of types
Signed-off-by: ahao-anyscale <[email protected]>
eicherseiji
left a comment
There was a problem hiding this comment.
Great work, @ahao-anyscale !
Co-authored-by: angelinalg <[email protected]> Signed-off-by: ahao-anyscale <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]> Co-authored-by: Nikhil G <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: Masahiro Tanaka <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]> Co-authored-by: Nikhil G <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: Gang Zhao <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]> Co-authored-by: Nikhil G <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: sampan <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]> Co-authored-by: Nikhil G <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: jugalshah291 <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]> Co-authored-by: Nikhil G <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: ahao-anyscale <[email protected]> Co-authored-by: Nikhil G <[email protected]> Co-authored-by: angelinalg <[email protected]>
Why are these changes needed?
adds endpoint for the serve api which already exists in vLLM as described here: https://docs.vllm.ai/en/v0.10.0/serving/openai_compatible_server.html#score-api_1
Related issue number
Closes #55388
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.Notes:
Score endpoint is only supported by vllm v0, must set
"VLLM_USE_V1": "0"in the env_vars. Unsure of how to document this