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 16, 08:15 UTC
[Misc] report relevant env vars in collect_env.py tool (#9293)
Jiangtao Hu committed
Nov 7, 2024 at 16:14 UTC
073a4727282b00f3626d5fdf720bd19589db7b48
1 file changed
+25
-3
collect_env.py
+25
-3
@@ -1,17 +1,19 @@
1
# ruff: noqa
2
# code borrowed from https://github.com/pytorch/pytorch/blob/main/torch/utils/collect_env.py
3
4
-# Unlike the rest of the PyTorch this file must be python2 compliant.
5
-# This script outputs relevant system environment info
6
-# Run it with `python collect_env.py` or `python -m torch.utils.collect_env`
4
import datetime
5
import locale
6
import os
7
import re
8
import subprocess
9
import sys
10
+# Unlike the rest of the PyTorch this file must be python2 compliant.
11
+# This script outputs relevant system environment info
12
+# Run it with `python collect_env.py` or `python -m torch.utils.collect_env`
13
from collections import namedtuple
14
15
+from vllm.envs import environment_variables
16
+
17
try:
18
import torch
19
TORCH_AVAILABLE = True
@@ -52,6 +54,7 @@ SystemEnv = namedtuple(
54
'vllm_version', # vllm specific field
55
'vllm_build_flags', # vllm specific field
56
'gpu_topo', # vllm specific field
57
+ 'env_vars',
58
])
59
60
DEFAULT_CONDA_PATTERNS = {
@@ -512,6 +515,22 @@ def is_xnnpack_available():
515
else:
516
return "N/A"
517
518
+def get_env_vars():
519
+ env_vars = ''
520
+ secret_terms=('secret', 'token', 'api', 'access', 'password')
521
+ report_prefix = ("TORCH", "NCCL", "PYTORCH",
522
+ "CUDA", "CUBLAS", "CUDNN",
523
+ "OMP_", "MKL_",
524
+ "NVIDIA")
525
+ for k, v in os.environ.items():
526
+ if any(term in k.lower() for term in secret_terms):
527
+ continue
528
+ if k in environment_variables:
529
+ env_vars = env_vars + "{}={}".format(k, v) + "\n"
530
+ if k.startswith(report_prefix):
531
+ env_vars = env_vars + "{}={}".format(k, v) + "\n"
532
+
533
+ return env_vars
534
535
def get_env_info():
536
run_lambda = run
@@ -583,6 +602,7 @@ def get_env_info():
602
vllm_version=vllm_version,
603
vllm_build_flags=vllm_build_flags,
604
gpu_topo=gpu_topo,
605
+ env_vars=get_env_vars(),
606
)
607
608
@@ -631,6 +651,8 @@ vLLM Build Flags:
651
{vllm_build_flags}
652
GPU Topology:
653
{gpu_topo}
654
+
655
+{env_vars}
656
""".strip()
657
658