From 40766ca1b8b0ef92e220595bda96c4336b597e5b Mon Sep 17 00:00:00 2001 From: Rafael Vasquez Date: Wed, 11 Dec 2024 04:27:39 -0500 Subject: [PATCH] [Bugfix]: Clamp `-inf` logprob values in prompt_logprobs (#11073) Signed-off-by: Rafael Vasquez --- vllm/entrypoints/openai/serving_completion.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vllm/entrypoints/openai/serving_completion.py b/vllm/entrypoints/openai/serving_completion.py index c54d5f07cf58c..ee97d35f2b087 100644 --- a/vllm/entrypoints/openai/serving_completion.py +++ b/vllm/entrypoints/openai/serving_completion.py @@ -392,6 +392,12 @@ def request_output_to_completion_response( prompt_token_ids = final_res.prompt_token_ids assert prompt_token_ids is not None prompt_logprobs = final_res.prompt_logprobs + if prompt_logprobs: + for logprob_dict in prompt_logprobs: + if logprob_dict: + for logprob_values in logprob_dict.values(): + if logprob_values.logprob == float('-inf'): + logprob_values.logprob = -9999.0 prompt_text = final_res.prompt token_ids: GenericSequence[int]