Skip to content

vllm.entrypoints.cli.benchmark.base

BenchmarkSubcommandBase

Bases: CLISubcommand

The base class of subcommands for vllm bench.

Source code in vllm/entrypoints/cli/benchmark/base.py
class BenchmarkSubcommandBase(CLISubcommand):
    """ The base class of subcommands for vllm bench. """

    @property
    def help(self) -> str:
        """The help message of the subcommand."""
        raise NotImplementedError

    def add_cli_args(self, parser: argparse.ArgumentParser) -> None:
        """Add the CLI arguments to the parser."""
        raise NotImplementedError

    @staticmethod
    def cmd(args: argparse.Namespace) -> None:
        """Run the benchmark.

        Args:
            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

help property

help: str

The help message of the subcommand.

add_cli_args

add_cli_args(parser: ArgumentParser) -> None

Add the CLI arguments to the parser.

Source code in vllm/entrypoints/cli/benchmark/base.py
def add_cli_args(self, parser: argparse.ArgumentParser) -> None:
    """Add the CLI arguments to the parser."""
    raise NotImplementedError

cmd staticmethod

cmd(args: Namespace) -> None

Run the benchmark.

Parameters:

Name Type Description Default
args Namespace

The arguments to the command.

required
Source code in vllm/entrypoints/cli/benchmark/base.py
@staticmethod
def cmd(args: argparse.Namespace) -> None:
    """Run the benchmark.

    Args:
        args: The arguments to the command.
    """
    raise NotImplementedError

subparser_init

subparser_init(
    subparsers: _SubParsersAction,
) -> FlexibleArgumentParser
Source code in vllm/entrypoints/cli/benchmark/base.py
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