PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
2.97k stars 461 forks source link

自行编译的fastdeploy无法使用gpu进行推理 #2533

Open tammy-na opened 2 weeks ago

tammy-na commented 2 weeks ago

环境

python setup.py build python setup.py bdist_wheel

问题日志及出现问题的操作流程

cd FastDeploy/examples/vision/ocr/PP-OCR/cpu-gpu/python python infer.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 --backend paddle [INFO] fastdeploy/runtime/backends/paddle/paddle_backend.cc(29)::BuildOption Will inference_precision float32 [INFO] fastdeploy/runtime/runtime.cc(286)::CreatePaddleBackend Runtime initialized with Backend::PDINFER in Device::GPU. [INFO] fastdeploy/runtime/backends/paddle/paddle_backend.cc(29)::BuildOption Will inference_precision float32 [INFO] fastdeploy/runtime/runtime.cc(286)::CreatePaddleBackend Runtime initialized with Backend::PDINFER in Device::GPU. [INFO] fastdeploy/runtime/backends/paddle/paddle_backend.cc(29)::BuildOption Will inference_precision float32 [INFO] fastdeploy/runtime/runtime.cc(286)::CreatePaddleBackend Runtime initialized with Backend::PDINFER in Device::GPU. free(): invalid size 已放弃 (核心已转储) 问题总结:当--device gpu 时会中断推理,当--device cpu时不存在问题: python infer.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 cpu --backend paddle [INFO] fastdeploy/runtime/runtime.cc(286)::CreatePaddleBackend Runtime initialized with Backend::PDINFER in Device::CPU. [INFO] fastdeploy/runtime/runtime.cc(286)::CreatePaddleBackend Runtime initialized with Backend::PDINFER in Device::CPU. [INFO] fastdeploy/runtime/runtime.cc(286)::CreatePaddleBackend Runtime initialized with Backend::PDINFER in Device::CPU. det boxes: [[42,413],[483,391],[484,428],[43,450]]rec text: 上海斯格威铂尔大酒店 rec score:0.980085 cls label: 0 cls score: 1.000000 det boxes: [[187,456],[399,448],[400,480],[188,488]]rec text: 打浦路15号 rec score:0.964993 cls label: 0 cls score: 1.000000 det boxes: [[23,507],[513,488],[515,529],[24,548]]rec text: 绿洲仕格维花园公寓 rec score:0.993727 cls label: 0 cls score: 1.000000 det boxes: [[74,553],[427,542],[428,571],[75,582]]rec text: 打浦路252935号 rec score:0.947723 cls label: 0 cls score: 1.000000

当我把自行编译的fastdeploy卸载之后安装:pip install fastdeploy-gpu-python==1.0.7 -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html,这时gpu和cpu都可以推理,我为什么非要重新编译fastdeploy是因为我想要添加如下内容到fastdeploy/vision/vision_pybind.cc文件中。 .def_readwrite("table_html", &vision::OCRResult::table_structure) .def_readwrite("table_boxes", &vision::OCRResult::table_boxes)

Jiang-Jia-Jun commented 1 week ago

Linux吗,你可以试下使用Paddle官方的镜像来编译