mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
【Hackathon 9th No.109】[CppExtension] 添加 fastdeploy_ops 目录到 package_data 以支持现代打包方式 (#5156)
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Publish Job / publish_pre_check (push) Has been cancelled
Publish Job / print_publish_pre_check_outputs (push) Has been cancelled
Publish Job / FD-Clone-Linux (push) Has been cancelled
Publish Job / Show Code Archive Output (push) Has been cancelled
Publish Job / BUILD_SM8090 (push) Has been cancelled
Publish Job / BUILD_SM8689 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8090 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8689 (push) Has been cancelled
Publish Job / Run FD Image Build (push) Has been cancelled
Publish Job / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
Publish Job / Run FastDeploy LogProb Tests (push) Has been cancelled
Publish Job / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
Publish Job / Run Base Tests (push) Has been cancelled
Publish Job / Run Accuracy Tests (push) Has been cancelled
Publish Job / Run Stable Tests (push) Has been cancelled
CI Images Build / FD-Clone-Linux (push) Has been cancelled
CI Images Build / Show Code Archive Output (push) Has been cancelled
CI Images Build / CI Images Build (push) Has been cancelled
CI Images Build / BUILD_SM8090 (push) Has been cancelled
CI Images Build / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
CI Images Build / Run FastDeploy LogProb Tests (push) Has been cancelled
CI Images Build / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
CI Images Build / Run Base Tests (push) Has been cancelled
CI Images Build / Publish Docker Images Pre Check (push) Has been cancelled
Some checks failed
CE Compile Job / ce_job_pre_check (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
CE Compile Job / print_ce_job_pre_check_outputs (push) Has been cancelled
CE Compile Job / FD-Clone-Linux (push) Has been cancelled
CE Compile Job / Show Code Archive Output (push) Has been cancelled
CE Compile Job / BUILD_SM8090 (push) Has been cancelled
CE Compile Job / BUILD_SM8689 (push) Has been cancelled
CE Compile Job / CE_UPLOAD (push) Has been cancelled
Publish Job / publish_pre_check (push) Has been cancelled
Publish Job / print_publish_pre_check_outputs (push) Has been cancelled
Publish Job / FD-Clone-Linux (push) Has been cancelled
Publish Job / Show Code Archive Output (push) Has been cancelled
Publish Job / BUILD_SM8090 (push) Has been cancelled
Publish Job / BUILD_SM8689 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8090 (push) Has been cancelled
Publish Job / PADDLE_PYPI_UPLOAD_8689 (push) Has been cancelled
Publish Job / Run FD Image Build (push) Has been cancelled
Publish Job / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
Publish Job / Run FastDeploy LogProb Tests (push) Has been cancelled
Publish Job / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
Publish Job / Run Base Tests (push) Has been cancelled
Publish Job / Run Accuracy Tests (push) Has been cancelled
Publish Job / Run Stable Tests (push) Has been cancelled
CI Images Build / FD-Clone-Linux (push) Has been cancelled
CI Images Build / Show Code Archive Output (push) Has been cancelled
CI Images Build / CI Images Build (push) Has been cancelled
CI Images Build / BUILD_SM8090 (push) Has been cancelled
CI Images Build / Run FastDeploy Unit Tests and Coverage (push) Has been cancelled
CI Images Build / Run FastDeploy LogProb Tests (push) Has been cancelled
CI Images Build / Extracted partial CE model tasks to run in CI. (push) Has been cancelled
CI Images Build / Run Base Tests (push) Has been cancelled
CI Images Build / Publish Docker Images Pre Check (push) Has been cancelled
--------- Co-authored-by: YuBaoku <49938469+EmmonsCurse@users.noreply.github.com> Co-authored-by: SigureMo <sigure.qaq@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/_accuracy_test.yml
vendored
2
.github/workflows/_accuracy_test.yml
vendored
@@ -143,7 +143,7 @@ jobs:
|
|||||||
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
||||||
-e TZ="Asia/Shanghai" \
|
-e TZ="Asia/Shanghai" \
|
||||||
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
|
|
||||||
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/_base_test.yml
vendored
2
.github/workflows/_base_test.yml
vendored
@@ -143,7 +143,7 @@ jobs:
|
|||||||
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
||||||
-e TZ="Asia/Shanghai" \
|
-e TZ="Asia/Shanghai" \
|
||||||
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
|
|
||||||
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/_build_linux.yml
vendored
2
.github/workflows/_build_linux.yml
vendored
@@ -155,7 +155,7 @@ jobs:
|
|||||||
elif [[ "${PADDLEVERSION}" != "" ]];then
|
elif [[ "${PADDLEVERSION}" != "" ]];then
|
||||||
python -m pip install paddlepaddle-gpu==${PADDLEVERSION} -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
|
python -m pip install paddlepaddle-gpu==${PADDLEVERSION} -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
|
||||||
else
|
else
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||||
|
|||||||
2
.github/workflows/_logprob_test_linux.yml
vendored
2
.github/workflows/_logprob_test_linux.yml
vendored
@@ -134,7 +134,7 @@ jobs:
|
|||||||
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
||||||
-e TZ="Asia/Shanghai" \
|
-e TZ="Asia/Shanghai" \
|
||||||
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
|
|
||||||
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/_pre_ce_test.yml
vendored
2
.github/workflows/_pre_ce_test.yml
vendored
@@ -154,7 +154,7 @@ jobs:
|
|||||||
--gpus "\"device=${DEVICES}\"" ${docker_image} /bin/bash -c '
|
--gpus "\"device=${DEVICES}\"" ${docker_image} /bin/bash -c '
|
||||||
git config --global --add safe.directory /workspace/FastDeploy
|
git config --global --add safe.directory /workspace/FastDeploy
|
||||||
cd FastDeploy
|
cd FastDeploy
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
python -m pip install ${fd_wheel_url}
|
python -m pip install ${fd_wheel_url}
|
||||||
bash scripts/run_pre_ce.sh
|
bash scripts/run_pre_ce.sh
|
||||||
'
|
'
|
||||||
|
|||||||
2
.github/workflows/_stable_test.yml
vendored
2
.github/workflows/_stable_test.yml
vendored
@@ -146,7 +146,7 @@ jobs:
|
|||||||
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
-v "${CACHE_DIR}/ConfigDir:/root/.config" \
|
||||||
-e TZ="Asia/Shanghai" \
|
-e TZ="Asia/Shanghai" \
|
||||||
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
--gpus '"device='"${DEVICES}"'"' ${docker_image} /bin/bash -xc '
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
|
|
||||||
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/_unit_test_coverage.yml
vendored
2
.github/workflows/_unit_test_coverage.yml
vendored
@@ -175,7 +175,7 @@ jobs:
|
|||||||
git config --global --add safe.directory /workspace/FastDeploy
|
git config --global --add safe.directory /workspace/FastDeploy
|
||||||
cd FastDeploy
|
cd FastDeploy
|
||||||
git diff origin/${BASE_REF}..HEAD --unified=0 > diff.txt
|
git diff origin/${BASE_REF}..HEAD --unified=0 > diff.txt
|
||||||
python -m pip install paddlepaddle-gpu==3.3.0.dev20251118 -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
python -m pip install --pre paddlepaddle-gpu -i https://www.paddlepaddle.org.cn/packages/nightly/cu126/
|
||||||
pip config set global.extra-index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
pip config set global.extra-index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
|
||||||
|
|
||||||
python -m pip install -r scripts/unittest_requirement.txt
|
python -m pip install -r scripts/unittest_requirement.txt
|
||||||
|
|||||||
68
build.sh
68
build.sh
@@ -77,47 +77,49 @@ function copy_ops(){
|
|||||||
PY_VERSION="py${PY_MAIN_VERSION}.${PY_SUB_VERSION}"
|
PY_VERSION="py${PY_MAIN_VERSION}.${PY_SUB_VERSION}"
|
||||||
SYSTEM_VERSION=`${python} -c "import platform; print(platform.system().lower())"`
|
SYSTEM_VERSION=`${python} -c "import platform; print(platform.system().lower())"`
|
||||||
PROCESSOR_VERSION=`${python} -c "import platform; print(platform.processor())"`
|
PROCESSOR_VERSION=`${python} -c "import platform; print(platform.processor())"`
|
||||||
WHEEL_NAME="fastdeploy_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"
|
EGG_NAME="fastdeploy_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"
|
||||||
WHEEL_CPU_NAME="fastdeploy_cpu_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"
|
EGG_CPU_NAME="fastdeploy_cpu_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"
|
||||||
|
|
||||||
# Add compatibility for modern python packaging methods
|
# Add compatibility for modern python packaging methods
|
||||||
WHEEL_MODERN_NAME="fastdeploy_ops"
|
LEGACY_PACKAGE_DIR="${OPS_TMP_DIR}/${EGG_NAME}"
|
||||||
WHEEL_MODERN_CPU_NAME="fastdeploy_cpu_ops"
|
MODERN_PACKAGE_DIR="${OPS_TMP_DIR}/fastdeploy_ops"
|
||||||
|
LEGACY_PACKAGE_DIR_CPU="${OPS_TMP_DIR}/${EGG_CPU_NAME}"
|
||||||
|
MODERN_PACKAGE_DIR_CPU="${OPS_TMP_DIR}/fastdeploy_cpu_ops"
|
||||||
|
|
||||||
# Handle GPU ops directories (WHEEL_MODERN_NAME and WHEEL_NAME)
|
# Handle GPU ops directory compatibility between modern and legacy naming
|
||||||
if [ -d "./${OPS_TMP_DIR}/${WHEEL_MODERN_NAME}" ]; then
|
if [ -d "${MODERN_PACKAGE_DIR}" ]; then
|
||||||
echo -e "${GREEN}[Info]${NONE} Ready to copy ops from modern directory ${WHEEL_MODERN_NAME} to target directory"
|
echo -e "${GREEN}[Info]${NONE} Ready to copy ops from modern directory ${WHEEL_MODERN_NAME} to target directory"
|
||||||
# Set WHEEL_NAME to empty string to ignore the directory path
|
TMP_PACKAGE_DIR="${OPS_TMP_DIR}"
|
||||||
WHEEL_NAME=""
|
# If modern directory doesn't exist, check for legacy directory, this branch should be removed in the future
|
||||||
|
elif [ -d "${LEGACY_PACKAGE_DIR}" ]; then
|
||||||
|
echo -e "${YELLOW}[Warning]${NONE} ${EGG_NAME} directory exists. This is a legacy packaging and distribution method."
|
||||||
|
TMP_PACKAGE_DIR="${LEGACY_PACKAGE_DIR}"
|
||||||
else
|
else
|
||||||
# If modern directory doesn't exist, check for deprecated directory
|
echo -e "${RED}[Error]${NONE} Neither modern nor legacy directory for gpu ops found in ${OPS_TMP_DIR}"
|
||||||
if [ -d "./${OPS_TMP_DIR}/${WHEEL_NAME}" ]; then
|
|
||||||
echo -e "${YELLOW}[Warning]${NONE} ${WHEEL_NAME} directory exists. This is a deprecated packaging and distribution method."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Handle CPU ops directories (WHEEL_MODERN_CPU_NAME and WHEEL_CPU_NAME)
|
# Handle CPU ops directory compatibility between modern and legacy naming
|
||||||
if [ -d "./${OPS_TMP_DIR}/${WHEEL_MODERN_CPU_NAME}" ]; then
|
if [ -d "${MODERN_PACKAGE_DIR_CPU}" ]; then
|
||||||
echo -e "${GREEN}[Info]${NONE} Ready to copy ops from modern directory ${WHEEL_MODERN_CPU_NAME} to target directory"
|
echo -e "${GREEN}[Info]${NONE} Ready to copy ops from modern directory ${WHEEL_MODERN_CPU_NAME} to target directory"
|
||||||
# Set WHEEL_CPU_NAME to empty string to ignore the directory path
|
TMP_PACKAGE_DIR_BASE="${OPS_TMP_DIR}"
|
||||||
WHEEL_CPU_NAME=""
|
# If modern directory doesn't exist, check for legacy directory, this branch should be removed in the future
|
||||||
|
elif [ -d "${LEGACY_PACKAGE_DIR_CPU}" ]; then
|
||||||
|
echo -e "${YELLOW}[Warning]${NONE} ${EGG_CPU_NAME} directory exists. This is a legacy packaging and distribution method."
|
||||||
|
TMP_PACKAGE_DIR_BASE="${LEGACY_PACKAGE_DIR_CPU}"
|
||||||
else
|
else
|
||||||
# If modern directory doesn't exist, check for deprecated directory
|
echo -e "${YELLOW}[Warning]${NONE} Neither modern nor legacy directory for cpu ops found in ${OPS_TMP_DIR}"
|
||||||
if [ -d "./${OPS_TMP_DIR}/${WHEEL_CPU_NAME}" ]; then
|
|
||||||
echo -e "${YELLOW}[Warning]${NONE} ${WHEEL_CPU_NAME} directory exists. This is a deprecated packaging and distribution method."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
is_rocm=`$python -c "import paddle; print(paddle.is_compiled_with_rocm())"`
|
is_rocm=`$python -c "import paddle; print(paddle.is_compiled_with_rocm())"`
|
||||||
if [ "$is_rocm" = "True" ]; then
|
if [ "$is_rocm" = "True" ]; then
|
||||||
DEVICE_TYPE="rocm"
|
DEVICE_TYPE="rocm"
|
||||||
cp -r ./${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/gpu
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/gpu
|
||||||
echo -e "ROCM ops have been copy to fastdeploy"
|
echo -e "ROCM ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
is_cuda=`$python -c "import paddle; print(paddle.is_compiled_with_cuda())"`
|
is_cuda=`$python -c "import paddle; print(paddle.is_compiled_with_cuda())"`
|
||||||
if [ "$is_cuda" = "True" ]; then
|
if [ "$is_cuda" = "True" ]; then
|
||||||
DEVICE_TYPE="gpu"
|
DEVICE_TYPE="gpu"
|
||||||
cp -r ./${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/gpu
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/gpu
|
||||||
echo -e "CUDA ops have been copy to fastdeploy"
|
echo -e "CUDA ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -125,7 +127,7 @@ function copy_ops(){
|
|||||||
is_xpu=`$python -c "import paddle; print(paddle.is_compiled_with_xpu())"`
|
is_xpu=`$python -c "import paddle; print(paddle.is_compiled_with_xpu())"`
|
||||||
if [ "$is_xpu" = "True" ]; then
|
if [ "$is_xpu" = "True" ]; then
|
||||||
DEVICE_TYPE="xpu"
|
DEVICE_TYPE="xpu"
|
||||||
cp -r ./${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/xpu
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/xpu
|
||||||
echo -e "xpu ops have been copy to fastdeploy"
|
echo -e "xpu ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -133,7 +135,7 @@ function copy_ops(){
|
|||||||
is_npu=`$python -c "import paddle; print(paddle.is_compiled_with_custom_device('npu'))"`
|
is_npu=`$python -c "import paddle; print(paddle.is_compiled_with_custom_device('npu'))"`
|
||||||
if [ "$is_npu" = "True" ]; then
|
if [ "$is_npu" = "True" ]; then
|
||||||
DEVICE_TYPE="npu"
|
DEVICE_TYPE="npu"
|
||||||
cp -r ${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/npu
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/npu
|
||||||
echo -e "npu ops have been copy to fastdeploy"
|
echo -e "npu ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -141,7 +143,7 @@ function copy_ops(){
|
|||||||
if_corex=`$python -c "import paddle; print(paddle.is_compiled_with_custom_device(\"iluvatar_gpu\"))"`
|
if_corex=`$python -c "import paddle; print(paddle.is_compiled_with_custom_device(\"iluvatar_gpu\"))"`
|
||||||
if [ "$if_corex" = "True" ]; then
|
if [ "$if_corex" = "True" ]; then
|
||||||
DEVICE_TYPE="iluvatar-gpu"
|
DEVICE_TYPE="iluvatar-gpu"
|
||||||
cp -r ./${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/iluvatar
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/iluvatar
|
||||||
echo -e "Iluvatar ops have been copy to fastdeploy"
|
echo -e "Iluvatar ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -149,7 +151,7 @@ function copy_ops(){
|
|||||||
is_gcu=`$python -c "import paddle; print(paddle.is_compiled_with_custom_device('gcu'))"`
|
is_gcu=`$python -c "import paddle; print(paddle.is_compiled_with_custom_device('gcu'))"`
|
||||||
if [ "$is_gcu" = "True" ]; then
|
if [ "$is_gcu" = "True" ]; then
|
||||||
DEVICE_TYPE="gcu"
|
DEVICE_TYPE="gcu"
|
||||||
cp -r ${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/gcu
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/gcu
|
||||||
echo -e "gcu ops have been copy to fastdeploy"
|
echo -e "gcu ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -158,8 +160,8 @@ function copy_ops(){
|
|||||||
if [ "$is_maca" = "True" ]; then
|
if [ "$is_maca" = "True" ]; then
|
||||||
DEVICE_TYPE="metax_gpu"
|
DEVICE_TYPE="metax_gpu"
|
||||||
mkdir -p ../fastdeploy/model_executor/ops/base
|
mkdir -p ../fastdeploy/model_executor/ops/base
|
||||||
cp -r ./${OPS_TMP_DIR_BASE}/${WHEEL_BASE_NAME}/* ../fastdeploy/model_executor/ops/base
|
cp -r ${OPS_TMP_DIR_BASE}/${WHEEL_BASE_NAME}/* ../fastdeploy/model_executor/ops/base
|
||||||
cp -r ./${OPS_TMP_DIR}/${WHEEL_NAME}/* ../fastdeploy/model_executor/ops/gpu
|
cp -r ${TMP_PACKAGE_DIR}/* ../fastdeploy/model_executor/ops/gpu
|
||||||
echo -e "MACA ops have been copy to fastdeploy"
|
echo -e "MACA ops have been copy to fastdeploy"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@@ -249,8 +251,14 @@ function extract_ops_from_precompiled_wheel() {
|
|||||||
echo -e "${BLUE}[precompiled]${NONE} Copying GPU precompiled contents..."
|
echo -e "${BLUE}[precompiled]${NONE} Copying GPU precompiled contents..."
|
||||||
mkdir -p "$DST_DIR"
|
mkdir -p "$DST_DIR"
|
||||||
cp -r "$SRC_DIR/deep_gemm" "$DST_DIR/" 2>/dev/null || true
|
cp -r "$SRC_DIR/deep_gemm" "$DST_DIR/" 2>/dev/null || true
|
||||||
cp -r "$SRC_DIR/fastdeploy_ops.py" "$DST_DIR/" 2>/dev/null || true
|
# Check for modern Python packaging approach (fastdeploy_ops directory)
|
||||||
cp -f "$SRC_DIR/"fastdeploy_ops_*.so "$DST_DIR/" 2>/dev/null || true
|
# If exists, copy the entire directory; otherwise, fall back to legacy method (individual files)
|
||||||
|
if [ -d "$SRC_DIR/fastdeploy_ops" ]; then
|
||||||
|
cp -r "$SRC_DIR/fastdeploy_ops" "$DST_DIR/" 2>/dev/null || true
|
||||||
|
else
|
||||||
|
cp -r "$SRC_DIR/fastdeploy_ops.py" "$DST_DIR/" 2>/dev/null || true
|
||||||
|
cp -f "$SRC_DIR/"fastdeploy_ops_*.so "$DST_DIR/" 2>/dev/null || true
|
||||||
|
fi
|
||||||
cp -f "$SRC_DIR/version.txt" "$DST_DIR/" 2>/dev/null || true
|
cp -f "$SRC_DIR/version.txt" "$DST_DIR/" 2>/dev/null || true
|
||||||
|
|
||||||
echo -e "${GREEN}[SUCCESS]${NONE} Installed FastDeploy using precompiled wheel."
|
echo -e "${GREEN}[SUCCESS]${NONE} Installed FastDeploy using precompiled wheel."
|
||||||
|
|||||||
@@ -24,30 +24,39 @@ PY_SUB_VERSION=`${python} -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $2}'`
|
|||||||
PY_VERSION="py${PY_MAIN_VERSION}.${PY_SUB_VERSION}"
|
PY_VERSION="py${PY_MAIN_VERSION}.${PY_SUB_VERSION}"
|
||||||
SYSTEM_VERSION=`${python} -c "import platform; print(platform.system().lower())"`
|
SYSTEM_VERSION=`${python} -c "import platform; print(platform.system().lower())"`
|
||||||
PROCESSOR_VERSION=`${python} -c "import platform; print(platform.processor())"`
|
PROCESSOR_VERSION=`${python} -c "import platform; print(platform.processor())"`
|
||||||
WHEEL_NAME="fastdeploy_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"
|
EGG_NAME="fastdeploy_ops-${OPS_VERSION}-${PY_VERSION}-${SYSTEM_VERSION}-${PROCESSOR_VERSION}.egg"
|
||||||
|
|
||||||
# Add compatibility for modern python packaging methods
|
# Add compatibility for modern python packaging methods
|
||||||
WHEEL_MODERN_NAME="fastdeploy_ops"
|
LEGACY_PACKAGE_DIR="${OPS_TMP_DIR}/${EGG_NAME}"
|
||||||
|
MODERN_PACKAGE_DIR="${OPS_TMP_DIR}/fastdeploy_ops"
|
||||||
|
|
||||||
|
# Check if OPS_TMP_DIR exists, create it if it doesn't
|
||||||
|
if [ ! -d "${OPS_TMP_DIR}" ]; then
|
||||||
|
echo -e "${GREEN}[Info]${NONE} Creating directory ${OPS_TMP_DIR}"
|
||||||
|
mkdir -p "${OPS_TMP_DIR}"
|
||||||
|
fi
|
||||||
|
|
||||||
${python} setup_ops.py install --install-lib ${OPS_TMP_DIR}
|
${python} setup_ops.py install --install-lib ${OPS_TMP_DIR}
|
||||||
|
|
||||||
# Handle directory compatibility between modern and legacy naming
|
# Handle directory compatibility between modern and legacy naming
|
||||||
if [ -d "./${OPS_TMP_DIR}/${WHEEL_MODERN_NAME}" ]; then
|
if [ -d "${MODERN_PACKAGE_DIR}" ]; then
|
||||||
echo -e "${GREEN}[Info]${NONE} Ready to use ops from modern directory ${WHEEL_MODERN_NAME}"
|
echo -e "${GREEN}[Info]${NONE} Ready to use ops from modern directory ${MODERN_PACKAGE_DIR}"
|
||||||
# Use modern directory name
|
# Use modern directory name
|
||||||
TARGET_DIR="${OPS_TMP_DIR}/${WHEEL_MODERN_NAME}"
|
TMP_PACKAGE_DIR="${OPS_TMP_DIR}"
|
||||||
else
|
CUSTOM_OP_DLL_RPATH='$ORIGIN/../libs'
|
||||||
# If modern directory doesn't exist, check for legacy directory
|
CUSTOM_OP_DLL_PATH="${MODERN_PACKAGE_DIR}/fastdeploy_ops_pd_.so"
|
||||||
if [ -d "./${OPS_TMP_DIR}/${WHEEL_NAME}" ]; then
|
# If modern directory doesn't exist, check for legacy directory, this branch should be removed in the future
|
||||||
echo -e "${YELLOW}[Warning]${NONE} ${WHEEL_NAME} directory exists. This is a deprecated packaging and distribution method."
|
elif [ -d "${LEGACY_PACKAGE_DIR}" ]; then
|
||||||
else
|
echo -e "${YELLOW}[Warning]${NONE} ${LEGACY_PACKAGE_DIR} directory exists. This is a deprecated packaging and distribution method."
|
||||||
echo -e "${RED}[Error]${NONE} Neither modern nor legacy directory found in ${OPS_TMP_DIR}"
|
|
||||||
fi
|
|
||||||
# Use legacy directory name
|
# Use legacy directory name
|
||||||
TARGET_DIR="${OPS_TMP_DIR}/${WHEEL_NAME}"
|
TMP_PACKAGE_DIR="${LEGACY_PACKAGE_DIR}"
|
||||||
|
CUSTOM_OP_DLL_RPATH='$ORIGIN/libs'
|
||||||
|
CUSTOM_OP_DLL_PATH="${TMP_PACKAGE_DIR}/fastdeploy_ops_pd_.so"
|
||||||
|
else
|
||||||
|
echo -e "${RED}[Error]${NONE} Neither modern nor legacy directory for xpu ops found in ${OPS_TMP_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ${TARGET_DIR}/libs
|
mkdir -p ${TMP_PACKAGE_DIR}/libs
|
||||||
cp ${XVLLM_PATH}/xft_blocks/so/libxft_blocks.so ${TARGET_DIR}/libs/
|
cp ${XVLLM_PATH}/xft_blocks/so/libxft_blocks.so ${TMP_PACKAGE_DIR}/libs/
|
||||||
cp ${XVLLM_PATH}/infer_ops/so/libapiinfer.so ${TARGET_DIR}/libs/
|
cp ${XVLLM_PATH}/infer_ops/so/libapiinfer.so ${TMP_PACKAGE_DIR}/libs/
|
||||||
patchelf --set-rpath '$ORIGIN/libs' ${TARGET_DIR}/fastdeploy_ops_pd_.so
|
patchelf --set-rpath ${CUSTOM_OP_DLL_RPATH} ${CUSTOM_OP_DLL_PATH}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ echo "uninstall org"
|
|||||||
python -m pip uninstall paddlepaddle-xpu -y
|
python -m pip uninstall paddlepaddle-xpu -y
|
||||||
python -m pip uninstall fastdeploy-xpu -y
|
python -m pip uninstall fastdeploy-xpu -y
|
||||||
|
|
||||||
python -m pip install https://paddle-whl.bj.bcebos.com/nightly/xpu-p800/paddlepaddle-xpu/paddlepaddle_xpu-3.3.0.dev20251118-cp310-cp310-linux_x86_64.whl
|
python -m pip install paddlepaddle-xpu -i https://www.paddlepaddle.org.cn/packages/nightly/xpu-p800/
|
||||||
|
|
||||||
echo "build whl"
|
echo "build whl"
|
||||||
bash custom_ops/xpu_ops/download_dependencies.sh develop
|
bash custom_ops/xpu_ops/download_dependencies.sh develop
|
||||||
|
|||||||
11
setup.py
11
setup.py
@@ -275,20 +275,31 @@ setup(
|
|||||||
url="https://github.com/PaddlePaddle/FastDeploy",
|
url="https://github.com/PaddlePaddle/FastDeploy",
|
||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
package_dir={"fastdeploy": "fastdeploy/"},
|
package_dir={"fastdeploy": "fastdeploy/"},
|
||||||
|
# For deprecated method (egg-based installation), `.so` files are placed in the `model_executor/ops/XXX` directory.
|
||||||
|
# For modern method (PEP 517/518-based installation), `.so` files are placed in the `model_executor/ops/XXX/fastdeploy_ops` directory.
|
||||||
|
# Therefore, the `fastdeploy_ops` directory should be included for modern Python packaging.
|
||||||
package_data={
|
package_data={
|
||||||
"fastdeploy": [
|
"fastdeploy": [
|
||||||
"model_executor/ops/gpu/*",
|
"model_executor/ops/gpu/*",
|
||||||
|
"model_executor/ops/gpu/fastdeploy_ops/*",
|
||||||
"model_executor/ops/gpu/deep_gemm/include/**/*",
|
"model_executor/ops/gpu/deep_gemm/include/**/*",
|
||||||
"model_executor/ops/cpu/*",
|
"model_executor/ops/cpu/*",
|
||||||
|
"model_executor/ops/cpu/fastdeploy_cpu_ops/*",
|
||||||
"model_executor/ops/xpu/*",
|
"model_executor/ops/xpu/*",
|
||||||
|
"model_executor/ops/xpu/fastdeploy_ops/*",
|
||||||
"model_executor/ops/xpu/libs/*",
|
"model_executor/ops/xpu/libs/*",
|
||||||
|
"model_executor/ops/xpu/fastdeploy_ops/libs/*",
|
||||||
"model_executor/ops/npu/*",
|
"model_executor/ops/npu/*",
|
||||||
|
"model_executor/ops/npu/fastdeploy_ops/*",
|
||||||
"model_executor/ops/base/*",
|
"model_executor/ops/base/*",
|
||||||
|
"model_executor/ops/base/fastdeploy_ops/*",
|
||||||
"model_executor/ops/iluvatar/*",
|
"model_executor/ops/iluvatar/*",
|
||||||
|
"model_executor/ops/iluvatar/fastdeploy_ops/*",
|
||||||
"model_executor/models/*",
|
"model_executor/models/*",
|
||||||
"model_executor/layers/*",
|
"model_executor/layers/*",
|
||||||
"input/ernie4_5_vl_processor/utils/*",
|
"input/ernie4_5_vl_processor/utils/*",
|
||||||
"model_executor/ops/gcu/*",
|
"model_executor/ops/gcu/*",
|
||||||
|
"model_executor/ops/gcu/fastdeploy_ops/*",
|
||||||
"version.txt",
|
"version.txt",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user