昇腾环境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算子。我没事,网上说这个方法有效。

相关推荐
Liudef0624 分钟前
神经辐射场 (NeRF):重构三维世界的AI新视角
人工智能·重构
音视频牛哥1 小时前
打造实时AI视觉系统:OpenCV结合RTSP|RTMP播放器的工程落地方案
人工智能·opencv·计算机视觉·大牛直播sdk·rtsp播放器·rtmp播放器·android rtmp
归去_来兮2 小时前
生成式对抗网络(GAN)模型原理概述
人工智能·深度学习·生成对抗网络
在努力的韩小豪2 小时前
如何从0开始构建自己的第一个AI应用?(Prompt工程、Agent自定义、Tuning)
人工智能·python·llm·prompt·agent·ai应用·mcp
云卓SKYDROID3 小时前
无人机环境感知系统运行与技术难点!
人工智能·计算机视觉·目标跟踪·无人机·科普·高科技·云卓科技
网安INF3 小时前
深度学习中的 Seq2Seq 模型与注意力机制
人工智能·深度学习·神经网络·注意力机制·seq2seq
火山引擎开发者社区3 小时前
ByteBrain x 清华 VLDB25|时序多模态大语言模型 ChatTS
人工智能·语言模型·自然语言处理
SoaringPigeon3 小时前
从深度学习的角度看自动驾驶
人工智能·深度学习·自动驾驶
产品经理独孤虾3 小时前
如何利用AI大模型对已有创意进行评估,打造杀手级的广告创意
人工智能·大模型·aigc·产品经理·数字营销·智能营销·智能创意生成
MobotStone4 小时前
无代码+AI时代,为什么你仍然需要像个开发者一样思考
人工智能·算法