From 3306dc8a007a4fcb787ce93100431426736d20c8 Mon Sep 17 00:00:00 2001 From: tanmayv25 Date: Mon, 9 Oct 2023 21:28:14 -0700 Subject: [PATCH 1/2] Fix the optional stream --- src/model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/model.py b/src/model.py index 7cbc2888..9888e2f1 100644 --- a/src/model.py +++ b/src/model.py @@ -179,7 +179,11 @@ async def generate(self, request): ).as_numpy()[0] if isinstance(prompt, bytes): prompt = prompt.decode("utf-8") - stream = pb_utils.get_input_tensor_by_name(request, "stream").as_numpy()[0] + stream = pb_utils.get_input_tensor_by_name(request, "stream") + if stream: + stream = stream.as_numpy()[0] + else: + stream = False # Request parameters are not yet supported via # BLS. Provide an optional mechanism to receive serialized From fa8f5a901d2f929b45aabd8b6363e02142047692 Mon Sep 17 00:00:00 2001 From: tanmayv25 Date: Mon, 9 Oct 2023 21:30:31 -0700 Subject: [PATCH 2/2] Formatting --- src/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model.py b/src/model.py index 9888e2f1..d80ca81d 100644 --- a/src/model.py +++ b/src/model.py @@ -181,9 +181,9 @@ async def generate(self, request): prompt = prompt.decode("utf-8") stream = pb_utils.get_input_tensor_by_name(request, "stream") if stream: - stream = stream.as_numpy()[0] + stream = stream.as_numpy()[0] else: - stream = False + stream = False # Request parameters are not yet supported via # BLS. Provide an optional mechanism to receive serialized