From e23545f46d91833368d9ece03dd03244ae2e4aab Mon Sep 17 00:00:00 2001 From: Chang Su Date: Mon, 30 Sep 2024 22:48:00 -0700 Subject: [PATCH] [Bugfix] Fix IndexError when output.logprobs is [] --- vllm/entrypoints/openai/serving_chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/entrypoints/openai/serving_chat.py b/vllm/entrypoints/openai/serving_chat.py index 29a5b11b595c..24ef856ccb64 100644 --- a/vllm/entrypoints/openai/serving_chat.py +++ b/vllm/entrypoints/openai/serving_chat.py @@ -402,7 +402,8 @@ async def chat_completion_stream_generator( if finish_reason_sent[i]: continue - if request.logprobs and request.top_logprobs is not None: + if (output.text and request.logprobs + and request.top_logprobs is not None): assert output.logprobs is not None, ( "Did not output logprobs") logprobs = self._create_chat_logprobs(