[Bugfix] Allow "None" or "" to be passed to CLI for string args that default to None (#4586)

This commit is contained in:
Michael Goin
2024-05-03 10:32:21 -07:00
committed by GitHub
parent 3521ba4f25
commit 7e65477e5e
2 changed files with 34 additions and 25 deletions
+15 -12
View File
@@ -8,7 +8,7 @@ import argparse
import json
import ssl
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.engine.arg_utils import AsyncEngineArgs, nullable_str
from vllm.entrypoints.openai.serving_engine import LoRAModulePath
@@ -25,7 +25,10 @@ class LoRAParserAction(argparse.Action):
def make_arg_parser():
parser = argparse.ArgumentParser(
description="vLLM OpenAI-Compatible RESTful API server.")
parser.add_argument("--host", type=str, default=None, help="host name")
parser.add_argument("--host",
type=nullable_str,
default=None,
help="host name")
parser.add_argument("--port", type=int, default=8000, help="port number")
parser.add_argument(
"--uvicorn-log-level",
@@ -49,13 +52,13 @@ def make_arg_parser():
default=["*"],
help="allowed headers")
parser.add_argument("--api-key",
type=str,
type=nullable_str,
default=None,
help="If provided, the server will require this key "
"to be presented in the header.")
parser.add_argument("--served-model-name",
nargs="+",
type=str,
type=nullable_str,
default=None,
help="The model name(s) used in the API. If multiple "
"names are provided, the server will respond to any "
@@ -65,33 +68,33 @@ def make_arg_parser():
"same as the `--model` argument.")
parser.add_argument(
"--lora-modules",
type=str,
type=nullable_str,
default=None,
nargs='+',
action=LoRAParserAction,
help="LoRA module configurations in the format name=path. "
"Multiple modules can be specified.")
parser.add_argument("--chat-template",
type=str,
type=nullable_str,
default=None,
help="The file path to the chat template, "
"or the template in single-line form "
"for the specified model")
parser.add_argument("--response-role",
type=str,
type=nullable_str,
default="assistant",
help="The role name to return if "
"`request.add_generation_prompt=true`.")
parser.add_argument("--ssl-keyfile",
type=str,
type=nullable_str,
default=None,
help="The file path to the SSL key file")
parser.add_argument("--ssl-certfile",
type=str,
type=nullable_str,
default=None,
help="The file path to the SSL cert file")
parser.add_argument("--ssl-ca-certs",
type=str,
type=nullable_str,
default=None,
help="The CA certificates file")
parser.add_argument(
@@ -102,12 +105,12 @@ def make_arg_parser():
)
parser.add_argument(
"--root-path",
type=str,
type=nullable_str,
default=None,
help="FastAPI root_path when app is behind a path based routing proxy")
parser.add_argument(
"--middleware",
type=str,
type=nullable_str,
action="append",
default=[],
help="Additional ASGI middleware to apply to the app. "