Skip to content

Commit 2e4a4e7

Browse files
authored
Make stream input optional (#58)
1 parent 2e29214 commit 2e4a4e7

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Quick_Deploy/vLLM/model_repository/vllm/1/model.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,20 @@ async def generate(self, request):
166166
self.ongoing_request_count += 1
167167
try:
168168
request_id = random_uuid()
169+
169170
prompt = pb_utils.get_input_tensor_by_name(request, "PROMPT").as_numpy()[0]
170171
if isinstance(prompt, bytes):
171172
prompt = prompt.decode("utf-8")
172-
stream = pb_utils.get_input_tensor_by_name(request, "STREAM").as_numpy()[0]
173+
174+
# stream is an optional input
175+
stream = False
176+
stream_input_tensor = pb_utils.get_input_tensor_by_name(request, "STREAM")
177+
if stream_input_tensor:
178+
stream = stream_input_tensor.as_numpy()[0]
173179

174180
# Request parameters are not yet supported via
175181
# BLS. Provide an optional mechanism to receive serialized
176182
# parameters as an input tensor until support is added
177-
178183
parameters_input_tensor = pb_utils.get_input_tensor_by_name(request, "SAMPLING_PARAMETERS")
179184
if parameters_input_tensor:
180185
parameters = parameters_input_tensor.as_numpy()[0].decode("utf-8")

Quick_Deploy/vLLM/model_repository/vllm/config.pbtxt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ input [
4949
name: "STREAM"
5050
data_type: TYPE_BOOL
5151
dims: [ 1 ]
52+
optional: true
5253
},
5354
{
5455
name: "SAMPLING_PARAMETERS"

0 commit comments

Comments
 (0)