PaddlePaddle / PaddlePaddle/FastDeploy
开启paddlelite支持在aarch64架构上编译不成功
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.7k
- Forks
- 756
- Avg merge
- 19h 28m
- Merged PRs (30d)
- 4
Description
环境
aarch64架构cpu 鲲鹏920 麒麟linux
问题说明:
想要编译一个在aarch64架构的上支持ppocr系列模型的fastdeploy-python。按文档,需要开启paddlelite支持。
按如下命令编译:
'''
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/python
export ENABLE_ORT_BACKEND=ON
export ENABLE_LITE_BACKEND=ON
export ENABLE_PADDLE_BACKEND=OFF
export ENABLE_OPENVINO_BACKEND=OFF
export ENABLE_VISION=ON
export ENABLE_TEXT=ON
python setup.py build
python setup.py bdist_wheel
'''
发现编译不通过。
初步排查有如下问题:
-
链接paddlelite的so文件失败。看了下代码,在编译时,会下载lite-linux-arm64-20221209.tgz,然后其中lite-linux-arm64-20221209\lib里包含一个._libpaddle_full_api_shared.so文件,这个文件是苹果电脑的索引文件,会导致构建脚本误以为它是共享库:
’‘’
AssertionError: patchelf /data/ai/fastdeploy/FastDeploy/python/.setuptools-cmake-build/third_libs/install/paddlelite/lib/._lib
paddle_full_api_shared.so failed, the command: /data/ai/fastdeploy/FastDeploy/python/.setuptools-cmake-build/third_libs/patchelf/bin/patchelf --set-rpath '$ORIGIN:$ORIGIN/mklml/lib/' /data/ai/fastdeploy/FastDeploy/python/.setuptools-cmake-build/third_l
ibs/install/paddlelite/lib/._libpaddle_full_api_shared.so
‘’‘
这个问题是1.02引入的,之前是lite-linux-arm64-20220920.tgz -
我把paddlelite的.so文件替换掉,可以编译成功(1.07版本),但是现在运行程序时报:
'''
2024-11-14 17:26:17,794 - uvicorn.error - ERROR - Traceback (most recent call last):
File "/root/miniconda3/envs/fastdeploy/lib/python3.10/site-packages/fastdeploy/c_lib_wrap.py", line 164, in
from .libs.fastdeploy_main import *
ImportError: /root/miniconda3/envs/fastdeploy/lib/python3.10/site-packages/fastdeploy/libs/libfastdeploy.so.1.0.7: undefined s
ymbol: ZN6paddle8lite_api6Tensor11CopyFromCpuIlLNS0_10TargetTypeE1EEEvPKT
''' -
由于还是未能成功运行。尝试用1.02版本使用lite后端运行ppocrv4,推理过程仍有错误。这部分错误没保存下来。
-
最后发现文档里写的,ppocr在aarch64架构linux只支持paddlelite是不对的,实际上支持onnx_runtime,我直接用1.02版本开启onnx_runtime后端就成功运行了。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with python/setup.py and the PaddleLite download and library-install steps described in the report; inspect how files in the extracted lib directory are selected and patched on aarch64. Reproduce the build with ENABLE_LITE_BACKEND=ON, then check the generated wheel and c_lib_wrap.py import; done means PaddleLite builds and the resulting package imports and runs the reported PP-OCR case, or the documentation correctly identifies the supported backend.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100