Avoid eager benchmark imports in CLI startup

This commit is contained in:
2026-04-20 14:00:44 +08:00
parent 91a15dfef1
commit 8fac6062e4
3 changed files with 39 additions and 16 deletions

View File

@@ -1,19 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from vllm.entrypoints.cli.benchmark.latency import BenchmarkLatencySubcommand
from vllm.entrypoints.cli.benchmark.mm_processor import (
BenchmarkMMProcessorSubcommand,
)
from vllm.entrypoints.cli.benchmark.serve import BenchmarkServingSubcommand
from vllm.entrypoints.cli.benchmark.startup import BenchmarkStartupSubcommand
from vllm.entrypoints.cli.benchmark.sweep import BenchmarkSweepSubcommand
from vllm.entrypoints.cli.benchmark.throughput import BenchmarkThroughputSubcommand
__all__: list[str] = [
"BenchmarkLatencySubcommand",
"BenchmarkMMProcessorSubcommand",
"BenchmarkServingSubcommand",
"BenchmarkStartupSubcommand",
"BenchmarkSweepSubcommand",
"BenchmarkThroughputSubcommand",
]
# Keep this package init import-free.
#
# The `vllm` console script imports `vllm.entrypoints.cli.main`, which causes
# Python to import this package before loading the `main` submodule.
# Eagerly importing benchmark subcommands here makes every `vllm serve ...`
# startup depend on optional benchmark-only modules.
#
# Benchmark subcommands are loaded on demand in
# `vllm.entrypoints.cli.benchmark.main`.