polish code with new pre-commit rule (#2923)

This commit is contained in:
Zero Rains
2025-07-19 23:19:27 +08:00
committed by GitHub
parent b8676d71a8
commit 25698d56d1
424 changed files with 14307 additions and 13518 deletions

View File

@@ -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.")