From df76d77d4b923334988ae3e0a02e4df9effe9822 Mon Sep 17 00:00:00 2001 From: Benjamin Muskalla Date: Tue, 9 Jul 2024 21:23:47 +0200 Subject: [PATCH 1/5] Sort mypy runs alphabetically This way it's easier to check which paths are missing --- .github/workflows/mypy.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 62f0dbcd93eff..73ff9037f1050 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -32,20 +32,20 @@ jobs: pip install types-setuptools - name: Mypy run: | + mypy tests --config-file pyproject.toml + mypy vllm/*.py --config-file pyproject.toml mypy vllm/attention --config-file pyproject.toml mypy vllm/core --config-file pyproject.toml mypy vllm/distributed --config-file pyproject.toml + mypy vllm/engine --config-file pyproject.toml mypy vllm/entrypoints --config-file pyproject.toml mypy vllm/executor --config-file pyproject.toml + mypy vllm/logging --config-file pyproject.toml + mypy vllm/lora --config-file pyproject.toml + mypy vllm/model_executor --config-file pyproject.toml mypy vllm/multimodal --config-file pyproject.toml - mypy vllm/usage --config-file pyproject.toml - mypy vllm/*.py --config-file pyproject.toml + mypy vllm/spec_decode --config-file pyproject.toml mypy vllm/transformers_utils --config-file pyproject.toml - mypy vllm/engine --config-file pyproject.toml + mypy vllm/usage --config-file pyproject.toml mypy vllm/worker --config-file pyproject.toml - mypy vllm/spec_decode --config-file pyproject.toml - mypy vllm/model_executor --config-file pyproject.toml - mypy vllm/lora --config-file pyproject.toml - mypy vllm/logging --config-file pyproject.toml - mypy tests --config-file pyproject.toml From 50eb3fab3183ddf122b1f70905b5b8e86af9220e Mon Sep 17 00:00:00 2001 From: Benjamin Muskalla Date: Tue, 9 Jul 2024 21:24:08 +0200 Subject: [PATCH 2/5] Enable check for `inputs` --- .github/workflows/mypy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 73ff9037f1050..814c0b152024f 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -40,6 +40,7 @@ jobs: mypy vllm/engine --config-file pyproject.toml mypy vllm/entrypoints --config-file pyproject.toml mypy vllm/executor --config-file pyproject.toml + mypy vllm/inputs --config-file pyproject.toml mypy vllm/logging --config-file pyproject.toml mypy vllm/lora --config-file pyproject.toml mypy vllm/model_executor --config-file pyproject.toml From 44394532a2bf6191e13ad7b798966c144056adca Mon Sep 17 00:00:00 2001 From: Benjamin Muskalla Date: Tue, 9 Jul 2024 21:30:36 +0200 Subject: [PATCH 3/5] Enable check for `platforms` --- .github/workflows/mypy.yaml | 1 + vllm/platforms/cuda.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index 814c0b152024f..5780f09a646cb 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -45,6 +45,7 @@ jobs: mypy vllm/lora --config-file pyproject.toml mypy vllm/model_executor --config-file pyproject.toml mypy vllm/multimodal --config-file pyproject.toml + mypy vllm/platforms --config-file pyproject.toml mypy vllm/spec_decode --config-file pyproject.toml mypy vllm/transformers_utils --config-file pyproject.toml mypy vllm/usage --config-file pyproject.toml diff --git a/vllm/platforms/cuda.py b/vllm/platforms/cuda.py index 2d482010cf760..02ba227460e3f 100644 --- a/vllm/platforms/cuda.py +++ b/vllm/platforms/cuda.py @@ -34,11 +34,10 @@ def get_physical_device_capability(device_id: int = 0) -> Tuple[int, int]: def device_id_to_physical_device_id(device_id: int) -> int: if "CUDA_VISIBLE_DEVICES" in os.environ: device_ids = os.environ["CUDA_VISIBLE_DEVICES"].split(",") - device_ids = [int(device_id) for device_id in device_ids] physical_device_id = device_ids[device_id] + return int(physical_device_id) else: - physical_device_id = device_id - return physical_device_id + return device_id class CudaPlatform(Platform): From de2b927acd625e7ca2fc5e9ab57d24290d5002a5 Mon Sep 17 00:00:00 2001 From: Benjamin Muskalla Date: Wed, 10 Jul 2024 13:26:34 +0200 Subject: [PATCH 4/5] Align format.sh with workflow Sort lines and add remaining folders --- format.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/format.sh b/format.sh index 8c54b56302d5b..94d02bd69818d 100755 --- a/format.sh +++ b/format.sh @@ -96,22 +96,24 @@ echo 'vLLM yapf: Done' # Run mypy echo 'vLLM mypy:' +mypy tests --config-file pyproject.toml +mypy vllm/*.py --config-file pyproject.toml mypy vllm/attention --config-file pyproject.toml mypy vllm/core --config-file pyproject.toml mypy vllm/distributed --config-file pyproject.toml +mypy vllm/engine --config-file pyproject.toml mypy vllm/entrypoints --config-file pyproject.toml mypy vllm/executor --config-file pyproject.toml +mypy vllm/inputs --config-file pyproject.toml +mypy vllm/logging --config-file pyproject.toml +mypy vllm/lora --config-file pyproject.toml +mypy vllm/model_executor --config-file pyproject.toml mypy vllm/multimodal --config-file pyproject.toml -mypy vllm/usage --config-file pyproject.toml -mypy vllm/*.py --config-file pyproject.toml +mypy vllm/platforms --config-file pyproject.toml +mypy vllm/spec_decode --config-file pyproject.toml mypy vllm/transformers_utils --config-file pyproject.toml -mypy vllm/engine --config-file pyproject.toml +mypy vllm/usage --config-file pyproject.toml mypy vllm/worker --config-file pyproject.toml -mypy vllm/spec_decode --config-file pyproject.toml -mypy vllm/model_executor --config-file pyproject.toml -mypy vllm/lora --config-file pyproject.toml -mypy vllm/logging --config-file pyproject.toml -mypy tests --config-file pyproject.toml # If git diff returns a file that is in the skip list, the file may be checked anyway: From 0f4d5d1b276e63ae0838302907b8b628f4b19585 Mon Sep 17 00:00:00 2001 From: Benjamin Muskalla Date: Wed, 10 Jul 2024 13:33:56 +0200 Subject: [PATCH 5/5] Align format.sh with workflow Sort lines and add remaining folders --- format.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/format.sh b/format.sh index 5edc868f9f70c..5ad6d6f2938bb 100755 --- a/format.sh +++ b/format.sh @@ -96,23 +96,23 @@ echo 'vLLM yapf: Done' # Run mypy echo 'vLLM mypy:' +mypy tests --config-file pyproject.toml +mypy vllm/*.py --config-file pyproject.toml mypy vllm/attention --config-file pyproject.toml mypy vllm/core --config-file pyproject.toml mypy vllm/distributed --config-file pyproject.toml +mypy vllm/engine --config-file pyproject.toml mypy vllm/entrypoints --config-file pyproject.toml mypy vllm/executor --config-file pyproject.toml +mypy vllm/logging --config-file pyproject.toml +mypy vllm/lora --config-file pyproject.toml +mypy vllm/model_executor --config-file pyproject.toml mypy vllm/multimodal --config-file pyproject.toml -mypy vllm/usage --config-file pyproject.toml -mypy vllm/*.py --config-file pyproject.toml +mypy vllm/prompt_adapter --config-file pyproject.toml +mypy vllm/spec_decode --config-file pyproject.toml mypy vllm/transformers_utils --config-file pyproject.toml -mypy vllm/engine --config-file pyproject.toml +mypy vllm/usage --config-file pyproject.toml mypy vllm/worker --config-file pyproject.toml -mypy vllm/spec_decode --config-file pyproject.toml -mypy vllm/model_executor --config-file pyproject.toml -mypy vllm/lora --config-file pyproject.toml -mypy vllm/logging --config-file pyproject.toml -mypy vllm/prompt_adapter --config-file pyproject.toml -mypy tests --config-file pyproject.toml # If git diff returns a file that is in the skip list, the file may be checked anyway: