Sync v2.0 version of code to github repo

This commit is contained in:
Jiang-Jia-Jun
2025-06-29 23:29:37 +00:00
parent d151496038
commit 92c2cfa2e7
597 changed files with 78776 additions and 22905 deletions

View File

@@ -13,14 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
"""
cuda platform file
"""
import paddle
from fastdeploy.utils import console_logger as logger
from .base import Platform, _Backend
from paddlenlp.utils.log import logger
class CUDAPlatform(Platform):
@@ -41,25 +42,23 @@ class CUDAPlatform(Platform):
logger.warning(
"You are using GPU version PaddlePaddle, but there is no GPU "
"detected on your machine. Maybe CUDA devices is not set properly."
f"\n Original Error is {e}"
)
f"\n Original Error is {e}")
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.APPEND_ATTN:
logger.info("Using APPEND ATTN backend.")
return ("fastdeploy.model_executor.layers.attention.AppendAttentionBackend")
else:
logger.warning(
"Other backends are not supported for now."
return (
"fastdeploy.model_executor.layers.attention.AppendAttentionBackend"
)
else:
logger.warning("Other backends are not supported for now.")