[Misc] Simplify vllm bench cli subcommand implementation (#19948)

This commit is contained in:
Ye (Charlotte) Qi
2025-06-22 12:34:48 -04:00
committed by GitHub
parent c76a506bd6
commit 2c11a29f0b
6 changed files with 44 additions and 80 deletions
+3 -17
View File
@@ -3,18 +3,15 @@
import argparse
from vllm.entrypoints.cli.types import CLISubcommand
from vllm.utils import FlexibleArgumentParser
class BenchmarkSubcommandBase(CLISubcommand):
""" The base class of subcommands for vllm bench. """
@property
def help(self) -> str:
"""The help message of the subcommand."""
raise NotImplementedError
help: str
def add_cli_args(self, parser: argparse.ArgumentParser) -> None:
@classmethod
def add_cli_args(cls, parser: argparse.ArgumentParser) -> None:
"""Add the CLI arguments to the parser."""
raise NotImplementedError
@@ -26,14 +23,3 @@ class BenchmarkSubcommandBase(CLISubcommand):
args: The arguments to the command.
"""
raise NotImplementedError
def subparser_init(
self,
subparsers: argparse._SubParsersAction) -> FlexibleArgumentParser:
parser = subparsers.add_parser(
self.name,
help=self.help,
description=self.help,
usage=f"vllm bench {self.name} [options]")
self.add_cli_args(parser)
return parser