Closed ChihoJack closed 7 months ago
版本是fastdeploy-gpu-python==0.2.1 ? 试下最新代码编译,附上编译和安装的步骤
版本是fastdeploy-gpu-python==0.2.1 ? 试下最新代码编译,附上编译和安装的步骤
编译代码: git clone https://github.com/PaddlePaddle/FastDeploy.git cd FastDeploy/python export BUILD_ON_JETSON=ON export ENABLE_VISION=ON
export ENABLE_PADDLE_BACKEND=ON export PADDLEINFERENCE_DIRECTORY=/Download/paddle_inference_jetson
python setup.py build python setup.py bdist_wheel 安装步骤: 编译完之后安装fastdeploy-gpu-python 安装代码如下: pip3 install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html 按照系统自动选择了fastdeploy-gpu-python==0.2.1
不是 pip3 install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html
而是pip install dist/xxx.whl,dist目录下生成的wheel文件
先uninstall,再install
我安装了wheel的文件,但是还是一样,这个方法我试过了
which python看一下 which pip看一下 要确保pip和python是对应的 然后pip list看一下
好,我现在试试看看
lcfc@lcfc-desktop:~$ which python /usr/bin/python lcfc@lcfc-desktop:~$ which pip /home/lcfc/.local/bin/pip lcfc@lcfc-desktop:~$ which pip3 /home/lcfc/.local/bin/pip3
不知道是不是版本的问题
看起来不对,建个conda环境 安装python和pip,然后编译和安装FastDeploy wheel吧
jetson环境无法安装conda,我一开始也想装个conda,但是会出现这个错误代码:Illegal instruction (core dumped)
所以我每次运行python3都只能加个OPENBLAS_CORETYPE=ARMV8,要不然import fastdeploy也会出现Illegal instruction (core dumped)
python3 -m pip list呢?
编译的时候用的是python还是python3命令
python3的命令,如果直接用python命令的话只能使用python2.7的
python3 -m pip list看下
lcfc@lcfc-desktop:~/Documents/FastDeploy-develop/examples/vision/ocr/PP-OCRv3/python$ python3 -m pip
Usage:
/usr/bin/python3 -m pip
Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. cache Inspect and manage pip's wheel cache. index Inspect information available from package indexes. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. debug Show information useful for debugging. help Show help for commands.
General Options:
-h, --help Show help.
--debug Let unhandled exceptions propagate outside the main subroutine, instead of logging them to
stderr.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING,
ERROR, and CRITICAL logging levels).
--log
list丢了
python3 -m pip list
lcfc@lcfc-desktop:~/Documents/FastDeploy-develop/examples/vision/ocr/PP-OCRv3/python$ python3 -m pip list Package Version
anyio 3.6.2 apturl 0.5.2 asgiref 3.4.1 asn1crypto 0.24.0 astor 0.8.1 attrdict 2.0.1 attrs 17.4.0 Babel 2.11.0 bce-python-sdk 0.8.79 beautifulsoup4 4.6.0 blinker 1.4 Brlapi 0.6.6 cachetools 4.2.4 certifi 2018.1.18 chardet 3.0.4 charset-normalizer 2.0.12 click 8.0.4 contextlib2 21.6.0 contextvars 2.4 cryptography 2.1.4 cssselect 1.1.0 cssutils 2.3.1 cupshelpers 1.0 cycler 0.10.0 Cython 0.29.33 dataclasses 0.8 decorator 4.1.2 defer 1.0.6 dill 0.3.4 distro-info 0.18ubuntu0.18.04.1 Django 2.2.15 et-xmlfile 1.1.0 fastapi 0.83.0 fastdeploy-gpu-python 0.2.1 fastdeploy-tools 0.0.5 feedparser 5.2.1 Flask 2.0.3 Flask-Babel 2.0.0 future 0.18.3 graphsurgeon 0.4.5 h11 0.13.0 html5lib 0.999999999 httplib2 0.9.2 idna 3.4 immutables 0.19 importlib-metadata 4.8.3 importlib-resources 5.4.0 itsdangerous 2.0.1 Jetson.GPIO 2.0.17 Jinja2 3.0.3 joblib 0.11 keyring 10.6.0 keyrings.alt 3.0 language-selector 0.1 lanms-neo 1.0.2 launchpadlib 1.10.6 lazr.restfulclient 0.13.5 lazr.uri 1.0.3 lmdb 1.4.0 louis 3.5.0 lxml 4.2.1 macaroonbakery 1.1.3 Mako 1.0.7 MarkupSafe 2.0.1 matplotlib 2.1.1 multiprocess 0.70.12.2 nose 1.3.7 numpy 1.19.5 oauth 1.0.1 oauthlib 2.0.6 onboard 1.4.1 opencv-contrib-python 4.6.0.66 opencv-python 4.6.0.66 openpyxl 3.1.1 opt-einsum 3.3.0 packaging 21.3 paddle-bfloat 0.1.7 paddle2onnx 1.0.5 paddlepaddle-gpu 2.3.2 pandas 0.22.0 Pillow 8.4.0 pip 21.3.1 pluggy 0.6.0 Polygon3 3.0.9.1 premailer 3.10.0 protobuf 3.19.6 py 1.5.2 pycairo 1.16.2 pyclipper 1.3.0.post4 pycrypto 2.6.1 pycryptodome 3.17 pycups 1.9.73 pydantic 1.9.2 PyGObject 3.26.1 PyJWT 1.5.3 pymacaroons 0.13.0 PyNaCl 1.1.2 pyparsing 2.2.0 pyRFC3339 1.0 pytest 3.3.2 python-apt 1.6.5+ubuntu0.6 python-dateutil 2.6.1 python-debian 0.1.32 python-docx 0.8.10 pytz 2018.3 pyxattr 0.6.0 pyxdg 0.25 PyYAML 3.12 rapidfuzz 2.11.1 requests 2.27.1 requests-unixsocket 0.1.5 scikit-learn 0.19.1 scipy 0.19.1 SecretStorage 2.3.1 setuptools 49.2.1 Shapely 1.8.5.post1 simplejson 3.13.2 six 1.16.0 sniffio 1.2.0 sqlparse 0.3.1 ssh-import-id 5.7 starlette 0.19.1 system-service 0.3 systemd-python 234 tensorrt 8.0.1.6 tqdm 4.64.1 typing_extensions 4.1.1 ubuntu-drivers-common 0.0.0 uff 0.6.9 unity-scope-calculator 0.1 unity-scope-chromiumbookmarks 0.1 unity-scope-colourlovers 0.1 unity-scope-devhelp 0.1 unity-scope-firefoxbookmarks 0.1 unity-scope-manpages 0.1 unity-scope-openclipart 0.1 unity-scope-texdoc 0.1 unity-scope-tomboy 0.1 unity-scope-virtualbox 0.1 unity-scope-yelp 0.1 unity-scope-zotero 0.1 urllib3 1.22 urwid 2.0.1 uvicorn 0.16.0 virtualenv 15.1.0 visualdl 2.4.2 wadllib 1.3.2 webencodings 0.5 Werkzeug 2.0.3 wheel 0.30.0 xkit 0.0.0 youtube_dl 2018.3.14 zipp 3.6.0 zope.interface 4.3.2
我的pip list有问题吗
这里的fastdeploy-gpu-python 还是0.2.1
python3 -m pip uninstall fastdeploy-gpu-python
再python3 -m pip install dist/xxx.whl
好,我试试
用了这些指令: python3 -m pip uninstall fastdeploy-gpu-python
再python3 -m pip install dist/xxx.whl
之后去PPOCRv3推理结果是这样子的:
lcfc@lcfc-desktop:~/Documents/FastDeploy-develop/examples/vision/ocr/PP-OCRv3/python$ OPENBLAS_CORETYPE=ARMV8 python3 test.py --det_model ch_PP-OCRv3_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv3_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device gpu
WARNING:root:The installed fastdeploy-python package is not built with GPU, will force to use CPU. To use GPU, following the commands to install fastdeploy-gpu-python.
WARNING:root: ================= Install GPU FastDeploy===============
WARNING:root: python -m pip uninstall fastdeploy-python
WARNING:root: python -m pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html
WARNING:root:The installed fastdeploy-python package is not built with GPU, will force to use CPU. To use GPU, following the commands to install fastdeploy-gpu-python.
WARNING:root: ================= Install GPU FastDeploy===============
WARNING:root: python -m pip uninstall fastdeploy-python
WARNING:root: python -m pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html
WARNING:root:The installed fastdeploy-python package is not built with GPU, will force to use CPU. To use GPU, following the commands to install fastdeploy-gpu-python.
WARNING:root: ================= Install GPU FastDeploy===============
WARNING:root: python -m pip uninstall fastdeploy-python
WARNING:root: python -m pip install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
File "test.py", line 188, in
再python3 -m pip list看下呢
lcfc@lcfc-desktop:~/Documents/FastDeploy-develop/examples/vision/ocr/PP-OCRv3/python$ python3 -m pip list Package Version
anyio 3.6.2 apturl 0.5.2 asgiref 3.4.1 asn1crypto 0.24.0 astor 0.8.1 attrdict 2.0.1 attrs 17.4.0 Babel 2.11.0 bce-python-sdk 0.8.79 beautifulsoup4 4.6.0 blinker 1.4 Brlapi 0.6.6 cachetools 4.2.4 certifi 2018.1.18 chardet 3.0.4 charset-normalizer 2.0.12 click 8.0.4 contextlib2 21.6.0 contextvars 2.4 cryptography 2.1.4 cssselect 1.1.0 cssutils 2.3.1 cupshelpers 1.0 cycler 0.10.0 Cython 0.29.33 dataclasses 0.8 decorator 4.1.2 defer 1.0.6 dill 0.3.4 distro-info 0.18ubuntu0.18.04.1 Django 2.2.15 et-xmlfile 1.1.0 fastapi 0.83.0 fastdeploy-python 0.0.0 fastdeploy-tools 0.0.5 feedparser 5.2.1 Flask 2.0.3 Flask-Babel 2.0.0 future 0.18.3 graphsurgeon 0.4.5 h11 0.13.0 html5lib 0.999999999 httplib2 0.9.2 idna 3.4 immutables 0.19 importlib-metadata 4.8.3 importlib-resources 5.4.0 itsdangerous 2.0.1 Jetson.GPIO 2.0.17 Jinja2 3.0.3 joblib 0.11 keyring 10.6.0 keyrings.alt 3.0 language-selector 0.1 lanms-neo 1.0.2 launchpadlib 1.10.6 lazr.restfulclient 0.13.5 lazr.uri 1.0.3 lmdb 1.4.0 louis 3.5.0 lxml 4.2.1 macaroonbakery 1.1.3 Mako 1.0.7 MarkupSafe 2.0.1 matplotlib 2.1.1 multiprocess 0.70.12.2 nose 1.3.7 numpy 1.19.5 oauth 1.0.1 oauthlib 2.0.6 onboard 1.4.1 opencv-contrib-python 4.6.0.66 opencv-python 4.6.0.66 openpyxl 3.1.1 opt-einsum 3.3.0 packaging 21.3 paddle-bfloat 0.1.7 paddle2onnx 1.0.5 paddlepaddle-gpu 2.3.2 pandas 0.22.0 Pillow 8.4.0 pip 21.3.1 pluggy 0.6.0 Polygon3 3.0.9.1 premailer 3.10.0 protobuf 3.19.6 py 1.5.2 pycairo 1.16.2 pyclipper 1.3.0.post4 pycrypto 2.6.1 pycryptodome 3.17 pycups 1.9.73 pydantic 1.9.2 PyGObject 3.26.1 PyJWT 1.5.3 pymacaroons 0.13.0 PyNaCl 1.1.2 pyparsing 2.2.0 pyRFC3339 1.0 pytest 3.3.2 python-apt 1.6.5+ubuntu0.6 python-dateutil 2.6.1 python-debian 0.1.32 python-docx 0.8.10 pytz 2018.3 pyxattr 0.6.0 pyxdg 0.25 PyYAML 3.12 rapidfuzz 2.11.1 requests 2.27.1 requests-unixsocket 0.1.5 scikit-learn 0.19.1 scipy 0.19.1 SecretStorage 2.3.1 setuptools 49.2.1 Shapely 1.8.5.post1 simplejson 3.13.2 six 1.16.0 sniffio 1.2.0 sqlparse 0.3.1 ssh-import-id 5.7 starlette 0.19.1 system-service 0.3 systemd-python 234 tensorrt 8.0.1.6 tqdm 4.64.1 typing_extensions 4.1.1 ubuntu-drivers-common 0.0.0 uff 0.6.9 unity-scope-calculator 0.1 unity-scope-chromiumbookmarks 0.1 unity-scope-colourlovers 0.1 unity-scope-devhelp 0.1 unity-scope-firefoxbookmarks 0.1 unity-scope-manpages 0.1 unity-scope-openclipart 0.1 unity-scope-texdoc 0.1 unity-scope-tomboy 0.1 unity-scope-virtualbox 0.1 unity-scope-yelp 0.1 unity-scope-zotero 0.1 urllib3 1.22 urwid 2.0.1 uvicorn 0.16.0 virtualenv 15.1.0 visualdl 2.4.2 wadllib 1.3.2 webencodings 0.5 Werkzeug 2.0.3 wheel 0.30.0 xkit 0.0.0 youtube_dl 2018.3.14 zipp 3.6.0 zope.interface 4.3.2
fastdeploy-python是CPU的,
这个命令具体执行的命令发一下python3 -m pip install dist/xxx.whl
另外看一下dist/目录
dist目录下只有这个文件: fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl 执行命令为: python3 -m pip instal fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl
dist目录下只有这个文件: fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl 执行命令为: python3 -m pip install fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl
编译的包不对,如果是gpu的应该是fastdeploy_gpu_python-0.0.0-cp36-cp36m-linux_aarch64.whl
删除FastDeploy/python目录下的build和.setuptools-cmake-build两个子目录后再重新编译试试吧,重新export那几个环境变量
好
按照你做完给我的方法,我重新编译了,但是还是没有生成fastdeploy_gpu_python-0.0.0-cp36-cp36m-linux_aarch64.whl,还是生成了fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl,之后运行还是一样。
按照你昨晚给我的方法,我重新编译了,但是还是没有生成fastdeploy_gpu_python-0.0.0-cp36-cp36m-linux_aarch64.whl,还是生成了fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl,之后运行还是一样。
我刚编译了一下,是生成的fastdeploy_gpu_python,把完整的编译log通过附件发一下吧
就是我编译一次,然后把log输出出来发出来是吧?
对
好的,稍等
看起来这两个环境变量的设置,都没有生效, export BUILD_ON_JETSON=ON export ENABLE_VISION=ON
那该如何解决呢,我已经按照文档说的将这两个环境变量设置了
echo $BUILD_ON_JETSON 看一下
还是一样,生成的还是fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl
@ChihoJack 建议不用安装wheel文件了,推测你的python环境可能设置上有些不同,你按如下方式来使用吧。
python setup.py build
和python setup.py bdist_wheel
两个命令export PYTHONPATH=${PWD}
,接下来再尝试(注意export变量仅在当前打开的命令终端生效)好的,我现在去试试
刚刚试了,生成的还是fastdeploy_python-0.0.0-cp36-cp36m-linux_aarch64.whl
无需安装任何whl文件,按照如下步骤执行即可
python setup.py build
和python setup.py bdist_wheel
两个命令export PYTHONPATH=${PWD}
,接下来再尝试(注意export变量仅在当前打开的命令终端生效)使用(例如打开python,执行import fastdeploy,或者是python my_script.py,注意是需要在同一个命令终端下)好,我再试试
我用了你这个方法,确实可以import fastdeploy,但是我之后查看了pip list,发现还是自动安装上了fastdeploy-python而不是fastdeploy-gpu-python
export PYTHONPATH之后,pip是否有安装已经不再重要。 因为python会优先使用PYTHONPATH下的fastdeploy
我就是用pythonpath的,然后还是发现不是gpu版本的
还有其他什么解决办法吗?
环境
使用fastdeploy中的PPOCRv3的GPU推理找不到PPOCRv3的模块,但是使用CPU推理却又可以,推理代码如下: OPENBLAS_CORETYPE=ARMV8 python3 test.py --det_model ch_PP-OCRv3_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv3_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device gpu
运行之后出现以下的情况: [WARNING] fastdeploy/backends/ort/ort_backend.cc(57)::BuildOption Compiled fastdeploy with onnxruntime doesn't support GPU, the available providers are CPUExecutionProvider, will fallback to CPUExecutionProvider. [INFO] fastdeploy/runtime.cc(283)::Init Runtime initialized with Backend::ORT in Device::GPU. [WARNING] fastdeploy/backends/ort/ort_backend.cc(57)::BuildOption Compiled fastdeploy with onnxruntime doesn't support GPU, the available providers are CPUExecutionProvider, will fallback to CPUExecutionProvider. [INFO] fastdeploy/runtime.cc(283)::Init Runtime initialized with Backend::ORT in Device::GPU. [WARNING] fastdeploy/backends/ort/ort_backend.cc(57)::BuildOption Compiled fastdeploy with onnxruntime doesn't support GPU, the available providers are CPUExecutionProvider, will fallback to CPUExecutionProvider. [INFO] fastdeploy/runtime.cc(283)::Init Runtime initialized with Backend::ORT in Device::GPU. Traceback (most recent call last): File "test.py", line 197, in
ppocr_v3 = fd.vision.ocr.PPOCRv3(
AttributeError: module 'fastdeploy.vision.ocr' has no attribute 'PPOCRv3'
请问该如何解决?