From dda35fd5506e388ca4f3f0ced82a0db88512fa3e Mon Sep 17 00:00:00 2001 From: Andrey Malyshev Date: Mon, 11 Dec 2023 08:14:03 +0000 Subject: [PATCH] Handle request not represented in json format --- serve/benchmarks/benchmark_serving.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/serve/benchmarks/benchmark_serving.py b/serve/benchmarks/benchmark_serving.py index 37a1f851d5..8cb3cd71f3 100644 --- a/serve/benchmarks/benchmark_serving.py +++ b/serve/benchmarks/benchmark_serving.py @@ -107,7 +107,11 @@ async def send_request( async for chunk, _ in response.content.iter_chunks(): chunks.append(chunk) output = b"".join(chunks).decode("utf-8") - output = json.loads(output) + try: + output = json.loads(output) + except: + print(output, prompt) + return # Re-send the request if it failed. if "error" not in output: