[CI/Build] Replace vllm.entrypoints.openai.api_server entrypoint with vllm serve command (#25967)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
+29
-5
@@ -1855,13 +1855,37 @@ class FlexibleArgumentParser(ArgumentParser):
|
||||
|
||||
# Check for --model in command line arguments first
|
||||
if args and args[0] == "serve":
|
||||
model_in_cli_args = any(arg == '--model' for arg in args)
|
||||
|
||||
if model_in_cli_args:
|
||||
raise ValueError(
|
||||
try:
|
||||
model_idx = next(
|
||||
i for i, arg in enumerate(args)
|
||||
if arg == "--model" or arg.startswith("--model="))
|
||||
logger.warning(
|
||||
"With `vllm serve`, you should provide the model as a "
|
||||
"positional argument or in a config file instead of via "
|
||||
"the `--model` option.")
|
||||
"the `--model` option. "
|
||||
"The `--model` option will be removed in v0.13.")
|
||||
|
||||
if args[model_idx] == "--model":
|
||||
model_tag = args[model_idx + 1]
|
||||
rest_start_idx = model_idx + 2
|
||||
else:
|
||||
model_tag = args[model_idx].removeprefix("--model=")
|
||||
rest_start_idx = model_idx + 1
|
||||
|
||||
# Move <model> to the front, e,g:
|
||||
# [Before]
|
||||
# vllm serve -tp 2 --model <model> --enforce-eager --port 8001
|
||||
# [After]
|
||||
# vllm serve <model> -tp 2 --enforce-eager --port 8001
|
||||
args = [
|
||||
"serve",
|
||||
model_tag,
|
||||
*args[1:model_idx],
|
||||
*args[rest_start_idx:],
|
||||
]
|
||||
print("args", args)
|
||||
except StopIteration:
|
||||
pass
|
||||
|
||||
if '--config' in args:
|
||||
args = self._pull_args_from_config(args)
|
||||
|
||||
Reference in New Issue
Block a user