File tree Expand file tree Collapse file tree 3 files changed +6
-19
lines changed Expand file tree Collapse file tree 3 files changed +6
-19
lines changed Original file line number Diff line number Diff line change 1010import torch
1111import 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
1618IS_NEOX_STYLE = [True ]
Original file line number Diff line number Diff line change 2222from 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
2828def 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
3233def rope_forward_oot (
Original file line number Diff line number Diff line change 1515# This file is a part of the vllm-ascend project.
1616#
1717
18- import logging
19- import os
2018from typing import TYPE_CHECKING , Optional , Tuple
2119
2220import torch
2725
2826from 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-
4228if TYPE_CHECKING :
4329 from vllm .config import ModelConfig , VllmConfig
4430 from vllm .utils import FlexibleArgumentParser
4733 VllmConfig = None
4834 FlexibleArgumentParser = None
4935
50- os .environ ["RAY_EXPERIMENTAL_NOSET_ASCEND_RT_VISIBLE_DEVICES" ] = "1"
51-
5236
5337class NPUPlatform (Platform ):
5438
You can’t perform that action at this time.
0 commit comments