A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 5, 02:15 UTC
[Bugfix] Fix bench_serve UTF-8 decode crash on split multi-byte chars (#38732)
Yufeng He committed
Apr 17, 2026 at 03:01 UTC
de111f32461bf751851c175af59e913fafaa16d1
1 file changed
+3
-1
vllm/benchmarks/lib/endpoint_request_func.py
+3
-1
@@ -2,6 +2,7 @@
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
"""The request function for API endpoints."""
4
5
+import codecs
6
import io
7
import json
8
import os
@@ -25,11 +26,12 @@ class StreamedResponseHandler:
26
27
def __init__(self):
28
self.buffer = ""
29
+ self._decoder = codecs.getincrementaldecoder("utf-8")()
30
31
def add_chunk(self, chunk_bytes: bytes) -> list[str]:
32
"""Add a chunk of bytes to the buffer and return any complete
33
messages."""
32
- chunk_str = chunk_bytes.decode("utf-8")
34
+ chunk_str = self._decoder.decode(chunk_bytes)
35
self.buffer += chunk_str
36
37
messages = []