昇腾环境ppstreuct部署问题记录

测试代码

我是在华为昇腾910B3上测试的PPStructure。

import os
import cv2
from PIL import Image
#from paddleocr import PPStructure,draw_structure_result,save_structure_res
from paddleocr_asyncio import PPStructure

table_engine = PPStructure(show_log=True, image_orientation=True, use_npu=True) #use_npu=False可以使用cpu推理

img_path = '/Users/fulva/Desktop/PicRec/table3.png'
img = cv2.imread(img_path)
result = table_engine(img)

print(f"result:", result)

问题1: Cannot open file inference.json

完整的报错如下:

[2025/01/18 03:22:27] ppcls WARNING: The current running environment does not support the use of GPU. CPU has been used instead.
Traceback (most recent call last):
  File "/home/aicc/paddleocr/test_pps.py", line 7, in <module>
    table_engine = PPStructure(show_log=True, image_orientation=True, use_npu=False)
.......
RuntimeError: (NotFound) Cannot open file /root/.paddleclas/inference_model/PULC/text_image_orientation/inference.json, please confirm whether the file is normal.
  [Hint: Expected paddle::inference::IsFileExists(prog_file_) == true, but received paddle::inference::IsFileExists(prog_file_):0 != true:1.] (at /paddle/paddle/fluid/inference/api/analysis_config.cc:111)

(MindIE_1.0.RC2) root@5e3540875002:/home/aicc/paddleocr# ls /root/.paddleclas/inference_model/PULC/text_image_orientation/
inference.pdiparams  inference.pdiparams.info  inference.pdmodel

报错很明显,找不到/root/.paddleclas/inference_model/PULC/text_image_orientation/inference.json这个文件,这个文件目录是自动下载的模型目录,的确没这个文件。应该是百度的模型格式改了,导致找不到。

参考:https://github.com/PaddlePaddle/PaddleClas/issues/3329

解决方法:

export FLAGS_enable_pir_api=0 

问题2:StridedSliceAssignD算子不支持

模型加载出错,查看plog看到如下打印

[ERROR] GE(3453963,python):2025-01-18-04:45:16.963.458 [dnnengine_manager.cc:399]3459354 GetDNNEngineName: ErrorNo: 1343242282(assign engine failed) [COMP][SUB_OPT][Check][OpSupported]Op type StridedSliceAssignD of ops kernel AIcoreEngine is unsupported, reason : [tbe-custom]:op type StridedSliceAssignD is not found in this op store.[tbe-custom1]:op type StridedSliceAssignD is not found in this op store.[tbe-custom]:op type StridedSliceAssignD is not found in this op store.[tbe-custom1]:op type StridedSliceAssignD is not found in this op store.The op is dynamic shape, but is not configured to support dynamic shape in op store
[ERROR] GE(3453963,python):2025-01-18-04:45:16.963.946 [dnnengine_manager.cc:416]3459354 GetDNNEngineName: ErrorNo: 1343242282(assign engine failed) [COMP][SUB_OPT][Get][DNNEngineName]Can't find any supported ops kernel and engine of StridedSliceAssign34, type is StridedSliceAssignD
[ERROR] GE(3453963,python):2025-01-18-04:45:16.964.163 [engine_place.cc:68]3459354 SelectEngine: ErrorNo: 1343229963(GE is not yet initialized or is finalized.) [COMP][SUB_OPT][Check][Param] Can not find engine of op name StridedSliceAssign34 type StridedSliceAssignD
[ERROR] GE(3453963,python):2025-01-18-04:45:16.964.368 [engine_place.cc:144]3459354 operator(): ErrorNo: 4294967295(failed) [COMP][SUB_OPT]Assert ((SelectEngine(node_ptr, exclude_engines, is_check_support_success, op_info)) == ge::SUCCESS) failed

临时解决方案:https://gitee.com/ascend/modelzoo/issues/I6Y31Z?from=project-issue&search_text=StridedSliceAssignD

也就是将其它算子修改名字和配置假装是StridedSliceAssignD算子。我没事,网上说这个方法有效。

相关推荐
boooo_hhh3 分钟前
深度学习笔记16-VGG-16算法-Pytorch实现人脸识别
pytorch·深度学习·机器学习
AnnyYoung7 分钟前
华为云deepseek大模型平台:deepseek满血版
人工智能·ai·华为云
INDEMIND1 小时前
INDEMIND:AI视觉赋能服务机器人,“零”碰撞避障技术实现全天候安全
人工智能·视觉导航·服务机器人·商用机器人
慕容木木1 小时前
【全网最全教程】使用最强DeepSeekR1+联网的火山引擎,没有生成长度限制,DeepSeek本体的替代品,可本地部署+知识库,注册即可有750w的token使用
人工智能·火山引擎·deepseek·deepseek r1
南 阳1 小时前
百度搜索全面接入DeepSeek-R1满血版:AI与搜索的全新融合
人工智能·chatgpt
企鹅侠客1 小时前
开源免费文档翻译工具 可支持pdf、word、excel、ppt
人工智能·pdf·word·excel·自动翻译
冰淇淋百宝箱2 小时前
AI 安全时代:SDL与大模型结合的“王炸组合”——技术落地与实战指南
人工智能·安全
Elastic 中国社区官方博客2 小时前
Elasticsearch Open Inference API 增加了对 Jina AI 嵌入和 Rerank 模型的支持
大数据·人工智能·elasticsearch·搜索引擎·ai·全文检索·jina
美狐美颜sdk3 小时前
直播美颜工具架构设计与性能优化实战:美颜SDK集成与实时处理
深度学习·美颜sdk·第三方美颜sdk·视频美颜sdk·美颜api
AWS官方合作商3 小时前
Amazon Lex:AI对话引擎重构企业服务新范式
人工智能·ai·机器人·aws