File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ #
2+ # Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+ # This file is a part of the vllm-ascend project.
4+ # Adapted from vllm-project/vllm/vllm/worker/worker.py
5+ # Copyright 2023 The vLLM team.
6+ #
7+ # Licensed under the Apache License, Version 2.0 (the "License");
8+ # you may not use this file except in compliance with the License.
9+ # You may obtain a copy of the License at
10+ #
11+ # http://www.apache.org/licenses/LICENSE-2.0
12+ #
13+ # Unless required by applicable law or agreed to in writing, software
14+ # distributed under the License is distributed on an "AS IS" BASIS,
15+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+ # See the License for the specific language governing permissions and
17+ # limitations under the License.
18+ #
19+
20+ from vllm .logger import init_logger
21+
22+ logger = init_logger (__name__ )
23+
24+
25+ def try_register_lib (lib_name : str , lib_info : str = "" ):
26+ import importlib
27+ import importlib .util
28+ try :
29+ module_spec = importlib .util .find_spec (lib_name )
30+ if module_spec is not None :
31+ importlib .import_module (lib_name )
32+ if lib_info :
33+ logger .info (lib_info )
34+ except Exception :
35+ pass
Original file line number Diff line number Diff line change 4747 WorkerInput )
4848
4949from vllm_ascend .model_runner import NPUModelRunner
50+ from vllm_ascend .utils import try_register_lib
5051
5152logger = init_logger (__name__ )
5253
@@ -69,6 +70,11 @@ def __init__(
6970 ) -> None :
7071
7172 WorkerBase .__init__ (self , vllm_config = vllm_config )
73+ # Try to import mindie_turbo to accelerate vLLM inference.
74+ try_register_lib (
75+ "mindie_turbo" ,
76+ "MindIE Turbo is installed. vLLM inference will be accelerated with MindIE Turbo."
77+ )
7278 # distribute related config
7379 self .parallel_config .rank = rank
7480 self .local_rank = local_rank
You can’t perform that action at this time.
0 commit comments