mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 16:48:03 +08:00
Sync v2.0 version of code to github repo
This commit is contained in:
@@ -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.")
|
||||
|
Reference in New Issue
Block a user