Skip to content

Commit 41bb5a3

Browse files
committed
add model path arg and option
1 parent 72b0e92 commit 41bb5a3

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/deepsparse/server/cli.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,17 @@
7979
),
8080
)
8181

82-
MODEL_OPTION = click.argument("model_path", type=str, default="default")
82+
MODEL_ARG = click.argument("model", type=str, default=None, required=False)
83+
MODEL_OPTION = click.option(
84+
"--model_path",
85+
type=str,
86+
default="default",
87+
help=(
88+
"The path to a model.onnx file, a model folder containing the model.onnx "
89+
"and supporting files, or a SparseZoo model stub. "
90+
"If not specified, the default model for the task is used."
91+
),
92+
)
8393

8494
BATCH_OPTION = click.option(
8595
"--batch_size",
@@ -143,6 +153,7 @@
143153
@PORT_OPTION
144154
@LOG_LEVEL_OPTION
145155
@HOT_RELOAD_OPTION
156+
@MODEL_ARG
146157
@MODEL_OPTION
147158
@BATCH_OPTION
148159
@CORES_OPTION
@@ -158,6 +169,7 @@ def main(
158169
log_level: str,
159170
hot_reload_config: bool,
160171
model_path: str,
172+
model: str,
161173
batch_size: int,
162174
num_cores: int,
163175
num_workers: int,
@@ -207,6 +219,13 @@ def main(
207219
...
208220
```
209221
"""
222+
# the server cli can take a model argument or --model_path option
223+
# if the --model_path option is provided, use that
224+
# otherwise if the argument is given and --model_path is not used, use the
225+
# argument instead
226+
if model and model_path == "default":
227+
model_path = model
228+
210229
if integration == INTEGRATION_OPENAI:
211230
if task is None or task != "text_generation":
212231
task = "text_generation"

0 commit comments

Comments
 (0)