Skip to content

Commit cf797aa

Browse files
authored
[core] port pynvml into vllm codebase (vllm-project#12963)
Signed-off-by: youkaichao <[email protected]>
1 parent 24700c3 commit cf797aa

File tree

6 files changed

+6169
-35
lines changed

6 files changed

+6169
-35
lines changed

.pre-commit-config.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,41 @@ repos:
88
- id: yapf
99
args: [--in-place, --verbose]
1010
additional_dependencies: [toml] # TODO: Remove when yapf is upgraded
11+
exclude: 'vllm/third_party/.*'
1112
- repo: https://github.com/astral-sh/ruff-pre-commit
1213
rev: v0.9.3
1314
hooks:
1415
- id: ruff
1516
args: [--output-format, github]
17+
exclude: 'vllm/third_party/.*'
1618
- repo: https://github.com/codespell-project/codespell
1719
rev: v2.4.0
1820
hooks:
1921
- id: codespell
20-
exclude: 'benchmarks/sonnet.txt|(build|tests/(lora/data|models/fixtures|prompts))/.*'
22+
exclude: 'benchmarks/sonnet.txt|(build|tests/(lora/data|models/fixtures|prompts))/.*|vllm/third_party/.*'
2123
- repo: https://github.com/PyCQA/isort
2224
rev: 5.13.2
2325
hooks:
2426
- id: isort
27+
exclude: 'vllm/third_party/.*'
2528
- repo: https://github.com/pre-commit/mirrors-clang-format
2629
rev: v19.1.7
2730
hooks:
2831
- id: clang-format
29-
exclude: 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))'
32+
exclude: 'csrc/(moe/topk_softmax_kernels.cu|quantization/gguf/(ggml-common.h|dequantize.cuh|vecdotq.cuh|mmq.cuh|mmvq.cuh))|vllm/third_party/.*'
3033
types_or: [c++, cuda]
3134
args: [--style=file, --verbose]
3235
- repo: https://github.com/jackdewinter/pymarkdown
3336
rev: v0.9.27
3437
hooks:
3538
- id: pymarkdown
3639
args: [fix]
40+
exclude: 'vllm/third_party/.*'
3741
- repo: https://github.com/rhysd/actionlint
3842
rev: v1.7.7
3943
hooks:
4044
- id: actionlint
45+
exclude: 'vllm/third_party/.*'
4146
- repo: local
4247
hooks:
4348
- id: mypy-local
@@ -47,44 +52,51 @@ repos:
4752
types: [python]
4853
additional_dependencies: &mypy_deps [mypy==1.11.1, types-setuptools, types-PyYAML, types-requests]
4954
stages: [pre-commit] # Don't run in CI
55+
exclude: 'vllm/third_party/.*'
5056
- id: mypy-3.9 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
5157
name: Run mypy for Python 3.9
5258
entry: tools/mypy.sh 1 "3.9"
5359
language: python
5460
types: [python]
5561
additional_dependencies: *mypy_deps
5662
stages: [manual] # Only run in CI
63+
exclude: 'vllm/third_party/.*'
5764
- id: mypy-3.10 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
5865
name: Run mypy for Python 3.10
5966
entry: tools/mypy.sh 1 "3.10"
6067
language: python
6168
types: [python]
6269
additional_dependencies: *mypy_deps
6370
stages: [manual] # Only run in CI
71+
exclude: 'vllm/third_party/.*'
6472
- id: mypy-3.11 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
6573
name: Run mypy for Python 3.11
6674
entry: tools/mypy.sh 1 "3.11"
6775
language: python
6876
types: [python]
6977
additional_dependencies: *mypy_deps
7078
stages: [manual] # Only run in CI
79+
exclude: 'vllm/third_party/.*'
7180
- id: mypy-3.12 # TODO: Use https://github.com/pre-commit/mirrors-mypy when mypy setup is less awkward
7281
name: Run mypy for Python 3.12
7382
entry: tools/mypy.sh 1 "3.12"
7483
language: python
7584
types: [python]
7685
additional_dependencies: *mypy_deps
7786
stages: [manual] # Only run in CI
87+
exclude: 'vllm/third_party/.*'
7888
- id: shellcheck
7989
name: Lint shell scripts
8090
entry: tools/shellcheck.sh
8191
language: script
8292
types: [shell]
93+
exclude: 'vllm/third_party/.*'
8394
- id: png-lint
8495
name: Lint PNG exports from excalidraw
8596
entry: tools/png-lint.sh
8697
language: script
8798
types: [png]
99+
exclude: 'vllm/third_party/.*'
88100
- id: signoff-commit
89101
name: Sign-off Commit
90102
entry: bash
@@ -97,17 +109,20 @@ repos:
97109
language: system
98110
verbose: true
99111
stages: [commit-msg]
112+
exclude: 'vllm/third_party/.*'
100113
- id: check-spdx-header
101114
name: Check SPDX headers
102115
entry: python tools/check_spdx_header.py
103116
language: python
104117
types: [python]
118+
exclude: 'vllm/third_party/.*'
105119
- id: suggestion
106120
name: Suggestion
107121
entry: bash -c 'echo "To bypass pre-commit hooks, add --no-verify to git commit."'
108122
language: system
109123
verbose: true
110124
pass_filenames: false
125+
exclude: 'vllm/third_party/.*'
111126
- id: check-filenames
112127
name: Check for spaces in all filenames
113128
entry: bash
@@ -117,3 +132,4 @@ repos:
117132
language: system
118133
always_run: true
119134
pass_filenames: false
135+
exclude: 'vllm/third_party/.*'

requirements-cuda.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
# Dependencies for NVIDIA GPUs
55
ray[default] >= 2.9
6-
nvidia-ml-py >= 12.560.30 # for pynvml package
76
torch == 2.5.1
87
torchaudio==2.5.1
98
# These must be updated alongside torch

tests/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ def _nvml():
4646
finally:
4747
amdsmi_shut_down()
4848
elif current_platform.is_cuda():
49-
from pynvml import (nvmlDeviceGetHandleByIndex, nvmlDeviceGetMemoryInfo,
50-
nvmlInit, nvmlShutdown)
49+
from vllm.third_party.pynvml import (nvmlDeviceGetHandleByIndex,
50+
nvmlDeviceGetMemoryInfo, nvmlInit,
51+
nvmlShutdown)
5152

5253
@contextmanager
5354
def _nvml():

vllm/third_party/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)