Skip to content

Commit

Permalink
Fixed stream=True option for VLLM template (#348)
Browse files Browse the repository at this point in the history
Currently when we process `model_input`, we popped the "stream"
property.

We want to maintain this property when openAI compatible mode is enabled
so stream works with openAI SDK calls
  • Loading branch information
derrick-yyang authored Sep 12, 2024
1 parent 370efd1 commit 0d99b3f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion phi/phi-3.5-mini/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
model_name: "Phi 3.5 Mini Instruct VLLM openai compatible"
python_version: py311
model_metadata:
example_model_input: {"prompt": "what is the meaning of life"}
example_model_input: {"messages": [{"role": "user", "content": "what is the meaning of life"}]}
repo_id: microsoft/Phi-3.5-mini-instruct
openai_compatible: true
vllm_config:
Expand Down
2 changes: 1 addition & 1 deletion phi/phi-3.5-mini/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def predict(self, model_input):
if "messages" not in model_input and "prompt" not in model_input:
raise ValueError("Prompt or messages must be provided")

stream = model_input.pop("stream", False)
stream = model_input.get("stream", False)
if self.openai_compatible:
# if the key metrics: true is present, let's return the vLLM /metrics endpoint
if model_input.get("metrics", False):
Expand Down
2 changes: 1 addition & 1 deletion vllm/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ async def predict(self, model_input):
if "messages" not in model_input and "prompt" not in model_input:
raise ValueError("Prompt or messages must be provided")

stream = model_input.pop("stream", False)
stream = model_input.get("stream", False)
if self.openai_compatible:
# if the key metrics: true is present, let's return the vLLM /metrics endpoint
if model_input.get("metrics", False):
Expand Down

0 comments on commit 0d99b3f

Please sign in to comment.