Skip to content

Commit 8840753

Browse files
sywangyiywang96
andauthored
[Bugfix]if the content is started with ":"(response of ping), client should i… (#5303)
Signed-off-by: Wang, Yi A <[email protected]> Co-authored-by: Roger Wang <[email protected]>
1 parent 916d219 commit 8840753

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

benchmarks/backend_request_func.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ async def async_request_tgi(
6868
chunk_bytes = chunk_bytes.strip()
6969
if not chunk_bytes:
7070
continue
71+
chunk_bytes = chunk_bytes.decode("utf-8")
7172

72-
chunk = remove_prefix(chunk_bytes.decode("utf-8"),
73-
"data:")
73+
#NOTE: Sometimes TGI returns a ping response without
74+
# any data, we should skip it.
75+
if chunk_bytes.startswith(":"):
76+
continue
77+
chunk = remove_prefix(chunk_bytes, "data:")
7478

7579
data = json.loads(chunk)
7680
timestamp = time.perf_counter()

0 commit comments

Comments
 (0)