Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paddleocr在昇腾910b上非常缓慢 #13977

Open
3 tasks done
bltcn opened this issue Oct 11, 2024 · 7 comments
Open
3 tasks done

paddleocr在昇腾910b上非常缓慢 #13977

bltcn opened this issue Oct 11, 2024 · 7 comments

Comments

@bltcn
Copy link

bltcn commented Oct 11, 2024

🔎 Search before asking

  • I have searched the PaddleOCR Docs and found no similar bug report.
  • I have searched the PaddleOCR Issues and found no similar bug report.
  • I have searched the PaddleOCR Discussions and found no similar bug report.

🐛 Bug (问题描述)

刚开始我以为是图片尺寸问题,然后我进行了归一化处理,将所有大小的图片都标准化成同样大小,但是只要换一张图片,速度基本就编程2、3分钟一张图片,这是什么原因

🏃‍♂️ Environment (运行环境)

cann 8.0.1
docker 24.0.1
firmware 24.0.1rc
就是按照官方的docker镜像来进行的

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

ppocr = paddleocr.PaddleOCR(use_angle_cls=False, lang="ch"
, det_model_dir="model/ch_PP-OCRv4_det"
, rec_model_dir="model/ch_PP-OCRv4_rec"
, cls_model_dir="model/ch_ppocr_mobile_v2.0_cls_infer"
, use_npu=True, det_db_thresh = params['DET_DB_THRESH']
, det_db_box_thresh = params['DET_DB_BOX_THRESH']
, det_db_score_mode = params['DET_DB_SCORE_MODE']
, enable_mkldnn=False
, rec_batch_num = 16
)
T3 = time.perf_counter()
result = ppocr.ocr(array, cls=False)
T4 = time.perf_counter()

@a31413510
Copy link
Collaborator

加上以下环境变量试试
export FLAGS_npu_jit_compile=0
export FLAGS_use_stride_kernel=0

@bltcn
Copy link
Author

bltcn commented Oct 11, 2024

谢谢,基本解决问题,还是有个疑问,它这个东西有没有类似tensorrt的缓存机制,否则每次重启应用之后都要先预热一遍,这个太麻烦了

@boreassun
Copy link

问一下,有没有910b的安装文档,我用paddleocr很慢还报错Warning: tiling offset out of range, index: 32。

@a31413510
Copy link
Collaborator

谢谢,基本解决问题,还是有个疑问,它这个东西有没有类似tensorrt的缓存机制,否则每次重启应用之后都要先预热一遍,这个太麻烦了

npu上第一次运行会触发一些算子的编译,所以第一次会慢一些,这个是npu硬件相关的机制,目前可能也很难避免哈,后续我们看看能不能优化一下。

@a31413510
Copy link
Collaborator

问一下,有没有910b的安装文档,我用paddleocr很慢还报错Warning: tiling offset out of range, index: 32。

可以参考这个文档:https:/PaddlePaddle/PaddleX/blob/develop/docs/other_devices_support/multy_devices_use_guide.md
建议可以直接使用PaddleX跑PaddleOCR,npu相关的环境都已经在PaddleX中内置好了。

@boreassun
Copy link

use_guide.md

好的谢谢,还要问一下paddleocr和paddlex哪个能支持昇腾910吗?

@a31413510
Copy link
Collaborator

use_guide.md

好的谢谢,还要问一下paddleocr和paddlex哪个能支持昇腾910吗?

都支持昇腾910B的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants