Skip to content

Commit 950fe93

Browse files
committed
fix dp issue temperarily
Signed-off-by: ganyi <pleaplusone.gy@gmail.com>
1 parent be1985d commit 950fe93

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

vllm_ascend/platform.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ class NPUPlatform(Platform):
5858
device_type: str = "npu"
5959
simple_compile_backend: str = "eager" # Disable torch.compile()
6060
ray_device_key: str = "NPU"
61-
device_control_env_var: str = "ASCEND_RT_VISIBLE_DEVICES"
61+
# device_control_env_var: str = "ASCEND_RT_VISIBLE_DEVICES"
62+
device_control_env_var: str = ""
6263
dispatch_key: str = "PrivateUse1"
6364

6465
supported_quantization: list[str] = [ASCEND_QUATIZATION_METHOD]

vllm_ascend/worker/worker_v1.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def __init__(
7575
distributed_init_method=distributed_init_method,
7676
is_driver_worker=is_driver_worker)
7777
# Try to import mindie_turbo to accelerate vLLM inference.
78+
local_dp_rank = self.vllm_config.parallel_config.data_parallel_rank_local
79+
world_size = self.vllm_config.parallel_config.world_size
80+
self.local_rank_across_dp = local_dp_rank * world_size + self.local_rank
7881
try_register_lib(
7982
"mindie_turbo",
8083
"MindIE Turbo is installed. vLLM inference will be accelerated with MindIE Turbo."
@@ -112,7 +115,7 @@ def wake_up(self, tags: Optional[list[str]] = None) -> None:
112115

113116
def init_device(self):
114117
if self.device_config.device.type == "npu":
115-
self.device = torch.device(f"npu:{self.local_rank}")
118+
self.device = torch.device(f"npu:{self.local_rank_across_dp}")
116119
NPUPlatform.set_device(self.device)
117120
NPUPlatform.empty_cache()
118121
self.init_npu_memory = NPUPlatform.mem_get_info()[0]

0 commit comments

Comments
 (0)