From 88407532e7ec2dd3313f6cb3a31d8dd1fa868178 Mon Sep 17 00:00:00 2001 From: "Wang, Yi" Date: Thu, 13 Jun 2024 11:16:41 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]if=20the=20content=20is=20started=20wit?= =?UTF-8?q?h=20":"(response=20of=20ping),=20client=20should=20i=E2=80=A6?= =?UTF-8?q?=20(#5303)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Wang, Yi A Co-authored-by: Roger Wang --- benchmarks/backend_request_func.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/benchmarks/backend_request_func.py b/benchmarks/backend_request_func.py index 58dcc6167efa..52386b8cd62b 100644 --- a/benchmarks/backend_request_func.py +++ b/benchmarks/backend_request_func.py @@ -68,9 +68,13 @@ async def async_request_tgi( chunk_bytes = chunk_bytes.strip() if not chunk_bytes: continue + chunk_bytes = chunk_bytes.decode("utf-8") - chunk = remove_prefix(chunk_bytes.decode("utf-8"), - "data:") + #NOTE: Sometimes TGI returns a ping response without + # any data, we should skip it. + if chunk_bytes.startswith(":"): + continue + chunk = remove_prefix(chunk_bytes, "data:") data = json.loads(chunk) timestamp = time.perf_counter()