diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml index 294b814b8..daeb9d01e 100644 --- a/.github/workflows/actionlint.yml +++ b/.github/workflows/actionlint.yml @@ -1,5 +1,4 @@ # -# Adapted from vllm-project/vllm/blob/main/.github # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from vllm-project/vllm/blob/main/.github # name: Lint GitHub Actions workflows diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml index f4ab52b18..2451a6fcf 100644 --- a/.github/workflows/mypy.yaml +++ b/.github/workflows/mypy.yaml @@ -1,5 +1,4 @@ # -# Adapted from vllm-project/vllm/blob/main/.github # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from vllm-project/vllm/blob/main/.github # name: mypy diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index a62c18c87..5780d5cb7 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -1,5 +1,4 @@ # -# Adapted from vllm-project/vllm/blob/main/.github # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from vllm-project/vllm/blob/main/.github # name: ruff diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 55b26a24b..3ff01d098 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -1,5 +1,4 @@ # -# Adapted from vllm-project/vllm/blob/main/.github # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from vllm-project/vllm/blob/main/.github # name: Lint shell scripts diff --git a/.github/workflows/vllm_ascend_test.yaml b/.github/workflows/vllm_ascend_test.yaml index 5e39f9332..af3b041d4 100644 --- a/.github/workflows/vllm_ascend_test.yaml +++ b/.github/workflows/vllm_ascend_test.yaml @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # name: 'e2e test' diff --git a/.github/workflows/yapf.yml b/.github/workflows/yapf.yml index 8441d04cf..a96b79d77 100644 --- a/.github/workflows/yapf.yml +++ b/.github/workflows/yapf.yml @@ -1,5 +1,4 @@ # -# Adapted from vllm-project/vllm/blob/main/.github # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from vllm-project/vllm/blob/main/.github # name: yapf diff --git a/Dockerfile b/Dockerfile index ad4d51e89..83f04ece8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # FROM quay.io/ascend/cann:8.0.0-910b-ubuntu22.04-py3.10 diff --git a/Dockerfile.openEuler b/Dockerfile.openEuler index 967b666de..a08a56613 100644 --- a/Dockerfile.openEuler +++ b/Dockerfile.openEuler @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # FROM quay.io/ascend/cann:8.0.0-910b-openeuler22.03-py3.10 diff --git a/collect_env.py b/collect_env.py index c2127fd73..68d97a7bc 100644 --- a/collect_env.py +++ b/collect_env.py @@ -1,5 +1,4 @@ # -# Adapted from https://github.com/vllm-project/vllm/blob/main/collect_env.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from https://github.com/vllm-project/vllm/blob/main/collect_env.py # import datetime diff --git a/docs/source/conf.py b/docs/source/conf.py index 4ec952a22..411efc6cd 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/docs/source/conf.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/docs/source/conf.py # # -- Path setup -------------------------------------------------------------- diff --git a/examples/offline_distributed_inference_npu.py b/examples/offline_distributed_inference_npu.py index 885337864..1af962b3b 100644 --- a/examples/offline_distributed_inference_npu.py +++ b/examples/offline_distributed_inference_npu.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/examples/offline_inference/basic.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/examples/offline_inference/basic.py # from vllm import LLM, SamplingParams diff --git a/examples/offline_inference_audio_language.py b/examples/offline_inference_audio_language.py index 25fabfda7..4f9d64ffa 100644 --- a/examples/offline_inference_audio_language.py +++ b/examples/offline_inference_audio_language.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/examples/offline_inference/audio_language.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/examples/offline_inference/audio_language.py # """ This example shows how to use vLLM for running offline inference diff --git a/examples/offline_inference_npu.py b/examples/offline_inference_npu.py index cb3963959..76d00d25b 100644 --- a/examples/offline_inference_npu.py +++ b/examples/offline_inference_npu.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/examples/offline_inference/basic.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/examples/offline_inference/basic.py # from vllm import LLM, SamplingParams diff --git a/format.sh b/format.sh index 32202aadf..bec7be4e7 100755 --- a/format.sh +++ b/format.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # # YAPF formatter, adapted from ray and skypilot. diff --git a/mypy.ini b/mypy.ini index 8d24259cc..72b03de21 100644 --- a/mypy.ini +++ b/mypy.ini @@ -9,3 +9,5 @@ ignore_missing_imports = True [mypy-transformers.*] ignore_missing_imports = True +[mypy-lm_eval.*] +ignore_missing_imports = True \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 9c8109487..75751af8f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,3 +2,5 @@ modelscope pytest >= 6.0 pytest-asyncio +lm-eval +ray \ No newline at end of file diff --git a/setup.py b/setup.py index 912de3cae..2b4d03dad 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/blob/main/setup.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/blob/main/setup.py # import importlib.util diff --git a/tests/conftest.py b/tests/conftest.py index 941e5b570..48430a760 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/blob/main/tests/conftest.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/blob/main/tests/conftest.py # import gc diff --git a/tests/model_utils.py b/tests/model_utils.py index 1b9eadccd..1aedd1c65 100644 --- a/tests/model_utils.py +++ b/tests/model_utils.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/blob/main/tests/models/utils.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/blob/main/tests/models/utils.py # import warnings diff --git a/tests/multicard/test_offline_inference_distributed.py b/tests/multicard/test_offline_inference_distributed.py index 1304001a1..d29c455f8 100644 --- a/tests/multicard/test_offline_inference_distributed.py +++ b/tests/multicard/test_offline_inference_distributed.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm/tests/basic_correctness/test_basic_correctness.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm/tests/basic_correctness/test_basic_correctness.py # """Compare the short outputs of HF and vLLM when using greedy sampling. diff --git a/tests/ops/test_fused_moe.py b/tests/ops/test_fused_moe.py index e78aa8f4a..be13f12fa 100644 --- a/tests/ops/test_fused_moe.py +++ b/tests/ops/test_fused_moe.py @@ -1,6 +1,4 @@ # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm/tests/kernels/test_moe.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # SPDX-License-Identifier: Apache-2.0 +# This file is a part of the vllm-ascend project. +# Adapted from vllm/tests/kernels/test_moe.py """Tests for the MOE layers. Run `pytest tests/ops/test_fused_moe.py`. diff --git a/tests/ops/test_rotary_embedding.py b/tests/ops/test_rotary_embedding.py index 5f4b3f916..3e48fe160 100644 --- a/tests/ops/test_rotary_embedding.py +++ b/tests/ops/test_rotary_embedding.py @@ -1,8 +1,8 @@ -# Adapted from -# https://github.com/vllm-project/vllm/blob/main/vllm/tests/kernels/test_rotary_embedding.py # Copyright 2023 The vLLM team. # Copyright (c) Huawei Technologies Co., Ltd. 2024-2025. All rights reserved. +# Adapted from +# https://github.com/vllm-project/vllm/blob/main/vllm/tests/kernels/test_rotary_embedding.py from typing import Optional, Tuple, Union diff --git a/tests/singlecard/test_accuracy.py b/tests/singlecard/test_accuracy.py new file mode 100644 index 000000000..503c010e4 --- /dev/null +++ b/tests/singlecard/test_accuracy.py @@ -0,0 +1,66 @@ +# +# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. +# Copyright 2023 The vLLM team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/blob/main/tests/entrypoints/llm/test_accuracy.py +# + +import gc +import multiprocessing +from multiprocessing import Queue + +import lm_eval +import pytest +import torch + +# pre-trained model path on Hugging Face. +MODEL_NAME = "Qwen/Qwen2.5-0.5B-Instruct" +# Math reasoning benchmark (Grade School Math 8K). +TASK = "gsm8k" +# Answer validation requiring format consistency. +FILTER = "exact_match,strict-match" +# 3% relative tolerance for numerical accuracy. +RTOL = 0.03 +# Baseline accuracy after VLLM optimization. +EXPECTED_VALUE = 0.316 + + +def run_test(queue, more_args=None): + model_args = f"pretrained={MODEL_NAME},max_model_len=4096" + if more_args is not None: + model_args = f"{model_args},{more_args}" + results = lm_eval.simple_evaluate( + model="vllm", + model_args=model_args, + tasks=TASK, + batch_size="auto", + ) + result = results["results"][TASK][FILTER] + print("result:", result) + queue.put(result) + del results + torch.npu.empty_cache() + gc.collect() + + +def test_lm_eval_accuracy(monkeypatch: pytest.MonkeyPatch): + with monkeypatch.context(): + result_queue: Queue[float] = multiprocessing.Queue() + p = multiprocessing.Process(target=run_test, args=(result_queue, )) + p.start() + p.join() + result = result_queue.get() + assert (EXPECTED_VALUE - RTOL < result < EXPECTED_VALUE + RTOL), \ + f"Expected: {EXPECTED_VALUE}±{RTOL} | Measured: {result}" \ No newline at end of file diff --git a/tests/singlecard/test_offline_inference.py b/tests/singlecard/test_offline_inference.py index 3c176052c..70619cffe 100644 --- a/tests/singlecard/test_offline_inference.py +++ b/tests/singlecard/test_offline_inference.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm/tests/basic_correctness/test_basic_correctness.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm/tests/basic_correctness/test_basic_correctness.py # """Compare the short outputs of HF and vLLM when using greedy sampling. diff --git a/tools/actionlint.sh b/tools/actionlint.sh index 482d866ee..072335bbd 100755 --- a/tools/actionlint.sh +++ b/tools/actionlint.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # if command -v actionlint &> /dev/null; then diff --git a/tools/check_repo.sh b/tools/check_repo.sh index e86d0f110..7b01da0fe 100644 --- a/tools/check_repo.sh +++ b/tools/check_repo.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # # Checks whether the repo is clean and whether tags are available (necessary to correctly produce vllm version at build time) diff --git a/tools/mypy.sh b/tools/mypy.sh index fcb7c0e4b..7f7f644e6 100755 --- a/tools/mypy.sh +++ b/tools/mypy.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # CI=${1:-0} diff --git a/tools/png-lint.sh b/tools/png-lint.sh index 5eeb11eda..3eb766701 100755 --- a/tools/png-lint.sh +++ b/tools/png-lint.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # # Ensure that *.excalidraw.png files have the excalidraw metadata diff --git a/tools/shellcheck.sh b/tools/shellcheck.sh index 1194e65e0..a10e17356 100755 --- a/tools/shellcheck.sh +++ b/tools/shellcheck.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # set -e diff --git a/tools/sphinx-lint.sh b/tools/sphinx-lint.sh index 806408013..2bedf37a0 100755 --- a/tools/sphinx-lint.sh +++ b/tools/sphinx-lint.sh @@ -2,8 +2,6 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -17,6 +15,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from https://github.com/vllm-project/vllm/tree/main/tools # sphinx-lint --disable trailing-whitespace,missing-final-newline docs diff --git a/vllm_ascend/__init__.py b/vllm_ascend/__init__.py index 31657dea5..926c77ee7 100644 --- a/vllm_ascend/__init__.py +++ b/vllm_ascend/__init__.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # diff --git a/vllm_ascend/attention/attention.py b/vllm_ascend/attention/attention.py index 178d38129..45f5e2565 100644 --- a/vllm_ascend/attention/attention.py +++ b/vllm_ascend/attention/attention.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # from dataclasses import dataclass diff --git a/vllm_ascend/attention/attention_v1.py b/vllm_ascend/attention/attention_v1.py index 1416e0cd8..6cd9a3a40 100644 --- a/vllm_ascend/attention/attention_v1.py +++ b/vllm_ascend/attention/attention_v1.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # from dataclasses import dataclass diff --git a/vllm_ascend/distributed/communicator.py b/vllm_ascend/distributed/communicator.py index 1c25db837..f8291f867 100644 --- a/vllm_ascend/distributed/communicator.py +++ b/vllm_ascend/distributed/communicator.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # from typing import Optional diff --git a/vllm_ascend/models/deepseek_v2.py b/vllm_ascend/models/deepseek_v2.py index 7d7bb938d..f38206e16 100644 --- a/vllm_ascend/models/deepseek_v2.py +++ b/vllm_ascend/models/deepseek_v2.py @@ -1,9 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -# Adapted from -# vllm-project/vllm/blob/main/vllm/model_executor/models/deepseek_v2.py -# https://github.com/huggingface/transformers/blob/v4.28.0/src/transformers/models/llama/modeling_llama.py -# vllm-project/vllm/vllm/model_executor/models/deepseek_v2.py # Copyright 2023 The vLLM team. # Copyright 2023 DeepSeek-AI and the HuggingFace Inc. team. All rights reserved. # @@ -23,6 +19,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from +# vllm-project/vllm/blob/main/vllm/model_executor/models/deepseek_v2.py +# https://github.com/huggingface/transformers/blob/v4.28.0/src/transformers/models/llama/modeling_llama.py +# vllm-project/vllm/vllm/model_executor/models/deepseek_v2.py """Inference-only DeepseekV2/DeepseekV3 model.""" from typing import Optional, Union diff --git a/vllm_ascend/models/qwen2_vl.py b/vllm_ascend/models/qwen2_vl.py index a3b4dc1c0..7eba68196 100644 --- a/vllm_ascend/models/qwen2_vl.py +++ b/vllm_ascend/models/qwen2_vl.py @@ -1,9 +1,7 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# Adapted from vllm/model_executor/models/qwen2_vl.py # Copyright 2023 The vLLM team. # -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +14,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# Adapted from vllm/model_executor/models/qwen2_vl.py +# This file is a part of the vllm-ascend project. from functools import partial from typing import Callable, Optional, Type diff --git a/vllm_ascend/ops/__init__.py b/vllm_ascend/ops/__init__.py index 2ae5f1a7e..2e59391b2 100644 --- a/vllm_ascend/ops/__init__.py +++ b/vllm_ascend/ops/__init__.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # import vllm_ascend.ops.activation # noqa import vllm_ascend.ops.fused_moe # noqa diff --git a/vllm_ascend/ops/activation.py b/vllm_ascend/ops/activation.py index 03072456e..dac9cb56b 100644 --- a/vllm_ascend/ops/activation.py +++ b/vllm_ascend/ops/activation.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # import torch diff --git a/vllm_ascend/ops/fused_moe.py b/vllm_ascend/ops/fused_moe.py index 2061b68ea..f1158be3b 100644 --- a/vllm_ascend/ops/fused_moe.py +++ b/vllm_ascend/ops/fused_moe.py @@ -1,6 +1,4 @@ # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm/tests/kernels/test_moe.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +12,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm/tests/kernels/test_moe.py from typing import Callable, Optional diff --git a/vllm_ascend/ops/layernorm.py b/vllm_ascend/ops/layernorm.py index 719aa977d..8ff4c559e 100644 --- a/vllm_ascend/ops/layernorm.py +++ b/vllm_ascend/ops/layernorm.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # from typing import Optional, Tuple, Union diff --git a/vllm_ascend/ops/rotary_embedding.py b/vllm_ascend/ops/rotary_embedding.py index 11f0f2320..32e660fa4 100644 --- a/vllm_ascend/ops/rotary_embedding.py +++ b/vllm_ascend/ops/rotary_embedding.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # from typing import Optional, Tuple diff --git a/vllm_ascend/platform.py b/vllm_ascend/platform.py index 75199614c..f48ee6e9a 100644 --- a/vllm_ascend/platform.py +++ b/vllm_ascend/platform.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # import logging diff --git a/vllm_ascend/quantization/quant_config.py b/vllm_ascend/quantization/quant_config.py index 91feb5047..96d33001a 100644 --- a/vllm_ascend/quantization/quant_config.py +++ b/vllm_ascend/quantization/quant_config.py @@ -1,6 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +13,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. # from types import MappingProxyType from typing import Any, Callable, Dict, List, Mapping, Optional diff --git a/vllm_ascend/utils.py b/vllm_ascend/utils.py index 80d3c4d28..bbc012af9 100644 --- a/vllm_ascend/utils.py +++ b/vllm_ascend/utils.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/vllm/worker/worker.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/vllm/worker/worker.py # import torch import torch_npu # noqa: F401 diff --git a/vllm_ascend/worker/model_runner.py b/vllm_ascend/worker/model_runner.py index c6fefe79f..702b9f3a8 100644 --- a/vllm_ascend/worker/model_runner.py +++ b/vllm_ascend/worker/model_runner.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/vllm/worker/model_runner.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/vllm/worker/model_runner.py # import dataclasses diff --git a/vllm_ascend/worker/model_runner_v1.py b/vllm_ascend/worker/model_runner_v1.py index 63d8bffef..d9beb3583 100644 --- a/vllm_ascend/worker/model_runner_v1.py +++ b/vllm_ascend/worker/model_runner_v1.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/vllm/worker/gpu_model_runner.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/vllm/worker/gpu_model_runner.py # import gc diff --git a/vllm_ascend/worker/pooling_model_runner.py b/vllm_ascend/worker/pooling_model_runner.py index 6fbe2d1da..f584a88f4 100644 --- a/vllm_ascend/worker/pooling_model_runner.py +++ b/vllm_ascend/worker/pooling_model_runner.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/vllm/worker/worker.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/vllm/worker/worker.py # import dataclasses from typing import Any, Dict, List, Optional, Tuple, Type diff --git a/vllm_ascend/worker/worker.py b/vllm_ascend/worker/worker.py index adeae078e..39d6fdca9 100644 --- a/vllm_ascend/worker/worker.py +++ b/vllm_ascend/worker/worker.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/vllm/worker/worker.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/vllm/worker/worker.py # import gc diff --git a/vllm_ascend/worker/worker_v1.py b/vllm_ascend/worker/worker_v1.py index 056e84e77..0bd18d5fd 100644 --- a/vllm_ascend/worker/worker_v1.py +++ b/vllm_ascend/worker/worker_v1.py @@ -1,7 +1,5 @@ # # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved. -# This file is a part of the vllm-ascend project. -# Adapted from vllm-project/vllm/vllm/worker/gpu_worker.py # Copyright 2023 The vLLM team. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,6 +13,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# This file is a part of the vllm-ascend project. +# Adapted from vllm-project/vllm/vllm/worker/gpu_worker.py # import gc