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

相同 cann环境下进行onnx 转换,在 310B 上执行推理报错 #300

Open
983183947 opened this issue Aug 10, 2024 · 2 comments
Open

Comments

@983183947
Copy link

983183947 commented Aug 10, 2024

操作步骤

1. 我先在910芯片的 cann7+mindspore2.2+mindspore_lite2.2.14上执行 onnx -->mindir转换得到.mindir文件
2.我在200 DK 开发板上执行步骤 1 得到的.mindir文件并进行推理,但是报错

说明

1. 目前只能在 200 DK 的310B板子上进行转换,但是大部分模型都转不动,运行几个小时后会报错。
2. mindcv 下的模型(resnet50)可以转成功

报错文件:paddle2mindir.log

环境(310B)

image image image image

环境(910)

image image image image

代码

import numpy as np
import mindspore_lite as mslite

# init context, and set target is ascend.
context = mslite.Context()
context.target = ["Ascend"]
context.ascend.device_id = 0
# build model from file
MODEL_PATH = "./paddle_clas_cann7_m22.mindir"
model = mslite.Model()
model.build_from_file(MODEL_PATH, mslite.ModelType.MINDIR, context)

报错

(mindspore) -sh-5.1# python infer.py 
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.704.903 [mindspore/lite/src/extendrt/kernel/ascend/model/model_process.cc:586] Load] Call aclmdlLoadFromMem failed, ret = 545002
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.705.027 [mindspore/lite/src/extendrt/kernel/ascend/model/model_infer.cc:150] Load] Load model model failed.
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.705.082 [mindspore/lite/src/extendrt/kernel/ascend/src/custom_ascend_kernel.cc:147] Init] Load om data failed.
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.705.137 [mindspore/lite/src/extendrt/session/single_op_session.cc:199] BuildCustomAscendKernelImpl] kernel init failed CustomAscend
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.706.811 [mindspore/lite/src/extendrt/session/single_op_session.cc:221] BuildCustomAscendKernel] Build ascend kernel failed for node: custom_0
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.706.877 [mindspore/lite/src/extendrt/session/single_op_session.cc:306] CompileGraph] Failed to Build custom ascend kernel
[ERROR] ME(2974,e7ffe882c020,python):2024-08-10-23:30:56.706.933 [mindspore/lite/src/extendrt/cxx_api/model/model_impl.cc:417] BuildByBufferImpl] compile graph failed.
Traceback (most recent call last):
  File "/opt/tmp/infer.py", line 12, in <module>
    model.build_from_file(MODEL_PATH, mslite.ModelType.MINDIR, context)
  File "/root/anaconda3/envs/mindspore/lib/python3.9/site-packages/mindspore_lite/model.py", line 111, in wrapper
    return func(*args, **kwargs)
  File "/root/anaconda3/envs/mindspore/lib/python3.9/site-packages/mindspore_lite/model.py", line 262, in build_from_file
    raise RuntimeError(
RuntimeError: build_from_file failed! Error is Common error code.
@zhouyifeng888
Copy link

确认下你这边说的200DK应该是200I DK A2吧?就拿200I DK A2来说,有不少开发者反馈过,由于A2板子内存小(4GB规格的内存),会出现模型转换失败的情况,或者mslite直接加载mindir进行推理的过程,其中也有转换编译的过程,也需要消耗一定的内存,A2板子很可能内存不够,可以试一下设置一下交换内存swap再看看(比如设置8G或者16G)

@983183947
Copy link
Author

我换了 orange pi有 24G 内存。也是一样的问题

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

2 participants