mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-11-03 11:02:01 +08:00
polish code with new pre-commit rule (#2923)
This commit is contained in:
@@ -15,14 +15,16 @@
|
||||
dcu platform file
|
||||
"""
|
||||
import paddle
|
||||
from .base import Platform, _Backend
|
||||
from paddleformers.utils.log import logger
|
||||
|
||||
from .base import Platform, _Backend
|
||||
|
||||
|
||||
class DCUPlatform(Platform):
|
||||
"""
|
||||
dcu platform class
|
||||
"""
|
||||
|
||||
device_name = "dcu"
|
||||
|
||||
@classmethod
|
||||
@@ -42,20 +44,15 @@ class DCUPlatform(Platform):
|
||||
return False
|
||||
|
||||
@classmethod
|
||||
def get_attention_backend_cls(
|
||||
cls,
|
||||
selected_backend
|
||||
):
|
||||
def get_attention_backend_cls(cls, selected_backend):
|
||||
"""
|
||||
get_attention_backend_cls
|
||||
"""
|
||||
if selected_backend == _Backend.NATIVE_ATTN:
|
||||
logger.info("Using NATIVE ATTN backend.")
|
||||
return ("fastdeploy.model_executor.layers.attention.PaddleNativeAttnBackend")
|
||||
return "fastdeploy.model_executor.layers.attention.PaddleNativeAttnBackend"
|
||||
elif selected_backend == _Backend.BLOCK_ATTN:
|
||||
logger.info("Using BLOCK ATTN backend.")
|
||||
return ("fastdeploy.model_executor.layers.attention.BlockAttentionBackend")
|
||||
return "fastdeploy.model_executor.layers.attention.BlockAttentionBackend"
|
||||
else:
|
||||
logger.warning(
|
||||
"Other backends are not supported for now."
|
||||
)
|
||||
logger.warning("Other backends are not supported for now.")
|
||||
|
||||
Reference in New Issue
Block a user