Add unit test local cpu guide and enable base testcase (#1566)
### What this PR does / why we need it? Use Base test and cleanup all manaul patch code - Cleanup EPLB config to avoid tmp test file - Use BaseTest with global cache - Add license - Add a doc to setup unit test in local env ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? CI passed Signed-off-by: Yikun Jiang <yikunkero@gmail.com>
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
from tests.ut.base import TestBase
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
import importlib
|
||||
import os
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
import torch
|
||||
from vllm.v1.sample.ops import topk_topp_sampler
|
||||
|
||||
from tests.ut.base import TestBase
|
||||
|
||||
class TestTopKTopPSamplerOptimize(unittest.TestCase):
|
||||
|
||||
class TestTopKTopPSamplerOptimize(TestBase):
|
||||
|
||||
@mock.patch.dict(os.environ, {"VLLM_ASCEND_ENABLE_TOPK_OPTIMIZE": "1"})
|
||||
@mock.patch("torch_npu.npu_top_k_top_p")
|
||||
def test_npu_topk_topp_called_when_optimized(self, mock_npu_op):
|
||||
# We have to patch and reload because the patch will take effect
|
||||
# only after VLLM_ASCEND_ENABLE_TOPK_OPTIMIZE is set.
|
||||
import vllm_ascend.patch.worker.patch_0_9_1.patch_sampler
|
||||
importlib.reload(vllm_ascend.patch.worker.patch_0_9_1.patch_sampler)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user