[Python] Add backward compatible for paddle2.4.2 (#1929)

* [Python] Add backward compatible for paddle2.4.2

* [Python] Add backward compatible for paddle2.4.2

* [scripts] update linux build scripts
This commit is contained in:
DefTruth
2023-05-11 19:34:06 +08:00
committed by GitHub
parent 643f41e711
commit 15c29f7e49
6 changed files with 214 additions and 25 deletions

View File

@@ -58,7 +58,7 @@ def get_default_cuda_major_version() -> str:
def find_cudart(search_dir: str) -> bool:
if search_dir is None:
print("[FastDeploy][ERROR]: search_dir can not be NoneTpye.")
logging.info("[FastDeploy][ERROR]: search_dir can not be NoneTpye.")
return False
# TODO(qiuyanjun): add Linux cudart *.so check
cudart_lib_name = f"cudart64_{get_default_cuda_major_version()}0.dll"
@@ -71,7 +71,7 @@ def find_cudart_from_sys() -> bool:
sys_paths = os.environ["path"].strip().split(";")
for sys_path in sys_paths:
if find_cudart(sys_path):
print(f"[FastDeploy][INFO]: Successfully found CUDA ToolKit from system PATH env -> {sys_path}")
logging.info(f"[FastDeploy][INFO]: Successfully found CUDA ToolKit from system PATH env -> {sys_path}")
return True
return False
@@ -137,7 +137,7 @@ def add_custom_cuda_path():
\n--- this path should look like: {default_cuda_dir}. \
\n--- Check FAQ: {base_url + 'develop/docs/FAQ.md'}")
return
print(f"[FastDeploy][INFO]: Successfully found CUDA ToolKit from -> {cuda_shared_lib_dir}")
logging.info(f"[FastDeploy][INFO]: Successfully found CUDA ToolKit from -> {cuda_shared_lib_dir}")
if os.name == "nt":
@@ -162,8 +162,8 @@ if os.name == "nt":
try:
from .libs.@PY_LIBRARY_NAME@ import *
except:
raise RuntimeError("FastDeploy initalized failed!")
except Exception as e:
raise RuntimeError(f"FastDeploy initalized failed! Error: {e}")
def TensorInfoStr(tensor_info):