Skip to content

Commit 6413b83

Browse files
committed
fix
1 parent 55c3277 commit 6413b83

3 files changed

Lines changed: 391 additions & 19 deletions

File tree

transformer_engine/plugin/core/backends/vendor/ascend/ascend.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,17 @@
1414

1515
from ....ops import TEFLBackendBase, FP8TensorMeta
1616

17-
1817
def _check_ascend_available() -> bool:
19-
if not torch_npu.npu.is_available():
20-
return False
21-
2218
import os
23-
2419
try:
2520
import torch_npu
26-
2721
return True
2822
except ImportError:
2923
print("[ASCEND] Disabled: import failed")
3024
return False
3125

3226

33-
class ASCENDBackend(TEFLBackendBase):
27+
class AscendBackend(TEFLBackendBase):
3428
@staticmethod
3529
def check_available() -> bool:
3630
return _check_ascend_available()
@@ -41,5 +35,9 @@ def __init__(self):
4135
def is_available(self) -> bool:
4236
return _check_ascend_available()
4337

38+
def get_flash_attention_class(self):
39+
from .flash_attention import FlashAttentionASCEND
40+
return FlashAttentionASCEND
41+
4442
def gelu(self, input: torch.Tensor, quantizer: Any) -> Any:
4543
return F.gelu(input)

0 commit comments

Comments
 (0)