A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 13:30 UTC
[Misc] add collect_env to cli and docker image (#16759)
Signed-off-by: rongfu.leng <rongfu.leng@daocloud.io>
rongfu.leng committed
Apr 18, 2025 at 13:13 UTC
7bdfd29a358ddbf9dc2544968f5bf9b700773be9
9 files changed
+54
-12
.github/ISSUE_TEMPLATE/200-installation.yml
+1
-1
@@ -14,7 +14,7 @@ body:
14
description: |
15
Please run the following and paste the output below.
16
```sh
17
- wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
17
+ wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
18
# For security purposes, please feel free to check the contents of collect_env.py before running it.
19
python collect_env.py
20
```
.github/ISSUE_TEMPLATE/300-usage.yml
+1
-1
@@ -14,7 +14,7 @@ body:
14
description: |
15
Please run the following and paste the output below.
16
```sh
17
- wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
17
+ wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
18
# For security purposes, please feel free to check the contents of collect_env.py before running it.
19
python collect_env.py
20
```
.github/ISSUE_TEMPLATE/400-bug-report.yml
+1
-1
@@ -14,7 +14,7 @@ body:
14
description: |
15
Please run the following and paste the output below.
16
```sh
17
- wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
17
+ wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
18
# For security purposes, please feel free to check the contents of collect_env.py before running it.
19
python collect_env.py
20
```
.github/ISSUE_TEMPLATE/700-performance-discussion.yml
+1
-1
@@ -35,7 +35,7 @@ body:
35
description: |
36
Please run the following and paste the output below.
37
```sh
38
- wget https://raw.githubusercontent.com/vllm-project/vllm/main/collect_env.py
38
+ wget https://raw.githubusercontent.com/vllm-project/vllm/main/vllm/collect_env.py
39
# For security purposes, please feel free to check the contents of collect_env.py before running it.
40
python collect_env.py
41
```
docker/Dockerfile
+1
@@ -241,6 +241,7 @@ if [ "$TARGETPLATFORM" != "linux/arm64" ]; then \
241
fi
242
COPY examples examples
243
COPY benchmarks benchmarks
244
+COPY ./vllm/collect_env.py .
245
246
# Although we build Flashinfer with AOT mode, there's still
247
# some issues w.r.t. JIT compilation. Therefore we need to
docker/Dockerfile.cpu
+1
@@ -121,6 +121,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
121
ADD ./tests/ ./tests/
122
ADD ./examples/ ./examples/
123
ADD ./benchmarks/ ./benchmarks/
124
+ADD ./vllm/collect_env.py .
125
126
# install development dependencies (for testing)
127
RUN --mount=type=cache,target=/root/.cache/uv \
vllm/collect_env.py
renamed
+11
-8
@@ -283,12 +283,13 @@ def get_vllm_version():
283
if __version__ == "dev":
284
return "N/A (dev)"
285
286
- if len(__version_tuple__) == 4: # dev build
287
- git_sha = __version_tuple__[-1][1:] # type: ignore
286
+ if len(__version_tuple__) == 4: # dev build
287
+ git_sha = __version_tuple__[-1][1:] # type: ignore
288
return f"{__version__} (git sha: {git_sha}"
289
290
return __version__
291
292
+
293
def summarize_vllm_build_flags():
294
# This could be a static method if the flags are constant, or dynamic if you need to check environment variables, etc.
295
return 'CUDA Archs: {}; ROCm: {}; Neuron: {}'.format(
@@ -502,7 +503,9 @@ def get_pip_packages(run_lambda, patterns=None):
503
print("uv is set")
504
cmd = ["uv", "pip", "list", "--format=freeze"]
505
else:
505
- raise RuntimeError("Could not collect pip list output (pip or uv module not available)")
506
+ raise RuntimeError(
507
+ "Could not collect pip list output (pip or uv module not available)"
508
+ )
509
510
out = run_and_read_all(run_lambda, cmd)
511
return "\n".join(line for line in out.splitlines()
@@ -535,13 +538,12 @@ def is_xnnpack_available():
538
else:
539
return "N/A"
540
541
+
542
def get_env_vars():
543
env_vars = ''
540
- secret_terms=('secret', 'token', 'api', 'access', 'password')
541
- report_prefix = ("TORCH", "NCCL", "PYTORCH",
542
- "CUDA", "CUBLAS", "CUDNN",
543
- "OMP_", "MKL_",
544
- "NVIDIA")
544
+ secret_terms = ('secret', 'token', 'api', 'access', 'password')
545
+ report_prefix = ("TORCH", "NCCL", "PYTORCH", "CUDA", "CUBLAS", "CUDNN",
546
+ "OMP_", "MKL_", "NVIDIA")
547
for k, v in os.environ.items():
548
if any(term in k.lower() for term in secret_terms):
549
continue
@@ -552,6 +554,7 @@ def get_env_vars():
554
555
return env_vars
556
557
+
558
def get_env_info():
559
run_lambda = run
560
pip_version, pip_list_output = get_pip_packages(run_lambda)
vllm/entrypoints/cli/collect_env.py
new
+35
@@ -0,0 +1,35 @@
1
+# SPDX-License-Identifier: Apache-2.0
2
+
3
+import argparse
4
+
5
+from vllm.collect_env import main as collect_env_main
6
+from vllm.entrypoints.cli.types import CLISubcommand
7
+from vllm.entrypoints.openai.cli_args import make_arg_parser
8
+from vllm.utils import FlexibleArgumentParser
9
+
10
+
11
+class CollectEnvSubcommand(CLISubcommand):
12
+ """The `serve` subcommand for the vLLM CLI. """
13
+
14
+ def __init__(self):
15
+ self.name = "collect-env"
16
+ super().__init__()
17
+
18
+ @staticmethod
19
+ def cmd(args: argparse.Namespace) -> None:
20
+ """Collect information about the environment."""
21
+ collect_env_main()
22
+
23
+ def subparser_init(
24
+ self,
25
+ subparsers: argparse._SubParsersAction) -> FlexibleArgumentParser:
26
+ serve_parser = subparsers.add_parser(
27
+ "collect-env",
28
+ help="Start collecting environment information.",
29
+ description="Start collecting environment information.",
30
+ usage="vllm collect-env")
31
+ return make_arg_parser(serve_parser)
32
+
33
+
34
+def cmd_init() -> list[CLISubcommand]:
35
+ return [CollectEnvSubcommand()]
vllm/entrypoints/cli/main.py
+2
@@ -5,6 +5,7 @@ import signal
5
import sys
6
7
import vllm.entrypoints.cli.benchmark.main
8
+import vllm.entrypoints.cli.collect_env
9
import vllm.entrypoints.cli.openai
10
import vllm.entrypoints.cli.serve
11
import vllm.version
@@ -15,6 +16,7 @@ CMD_MODULES = [
16
vllm.entrypoints.cli.openai,
17
vllm.entrypoints.cli.serve,
18
vllm.entrypoints.cli.benchmark.main,
19
+ vllm.entrypoints.cli.collect_env,
20
]
21
22