Skip to content

Commit ff1c83e

Browse files
committed
rm RAY_EXPERIMENTAL_NOSET_ASCEND_RT_VISIBLE_DEVICES & add lazy init for vllm_ascend_C
Signed-off-by: zhuo97 <1103045176@qq.com>
1 parent fd515cd commit ff1c83e

File tree

3 files changed

+6
-19
lines changed

3 files changed

+6
-19
lines changed

tests/ops/test_rotary_embedding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import torch
1111
import torch.nn as nn
1212

13-
import vllm_ascend.platform # noqa: F401
13+
from vllm_ascend.utils import try_register_lib
14+
15+
try_register_lib("vllm_ascend.vllm_ascend_C")
1416

1517
# Only Neox style true scenario is supported for now
1618
IS_NEOX_STYLE = [True]

vllm_ascend/ops/rotary_embedding.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
from vllm.model_executor.layers.rotary_embedding import (
2323
DeepseekScalingRotaryEmbedding, RotaryEmbedding)
2424

25-
from vllm_ascend.platform import CUSTOM_OP_ENABLED
25+
from vllm_ascend.utils import try_register_lib
2626

2727

2828
def custom_rotary_embedding_enabled(query, neox_style, head_size):
29-
return query.dtype == torch.float16 and neox_style and head_size % 32 == 0 and CUSTOM_OP_ENABLED
29+
try_register_lib("vllm_ascend.vllm_ascend_C")
30+
return query.dtype == torch.float16 and neox_style and head_size % 32 == 0
3031

3132

3233
def rope_forward_oot(

vllm_ascend/platform.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
# This file is a part of the vllm-ascend project.
1616
#
1717

18-
import logging
19-
import os
2018
from typing import TYPE_CHECKING, Optional, Tuple
2119

2220
import torch
@@ -27,18 +25,6 @@
2725

2826
from vllm_ascend.utils import update_aclgraph_sizes
2927

30-
CUSTOM_OP_ENABLED = False
31-
try:
32-
# register custom ops into torch_library here
33-
import vllm_ascend.vllm_ascend_C # type: ignore # noqa: F401
34-
35-
except ImportError:
36-
logging.warning(
37-
"Warning: Failed to register custom ops, all custom ops will be disabled"
38-
)
39-
else:
40-
CUSTOM_OP_ENABLED = True
41-
4228
if TYPE_CHECKING:
4329
from vllm.config import ModelConfig, VllmConfig
4430
from vllm.utils import FlexibleArgumentParser
@@ -47,8 +33,6 @@
4733
VllmConfig = None
4834
FlexibleArgumentParser = None
4935

50-
os.environ["RAY_EXPERIMENTAL_NOSET_ASCEND_RT_VISIBLE_DEVICES"] = "1"
51-
5236

5337
class NPUPlatform(Platform):
5438

0 commit comments

Comments
 (0)