onnx是支持dynamic input shape/dynamic axes的,但是MindSpore Lite不支持。

converter转换后,dynamic input shape/dynamic axes都变成-1,然后加载失败。

[mindspore/lite/src/runtime/scheduler.cc:928] InferSubGraphShape# InferShape failed, name: /model/decoder/Squeeze, type: Squeeze
[mindspore/lite/src/runtime/scheduler.cc:281] SchedulePreProcess# op infer shape failed.
[mindspore/lite/src/runtime/lite_session.cc:574] CompileGraph# Schedule kernels failed: -500
[mindspore/lite/src/runtime/lite_session.cc:1762] LoadModelAndCompileByBuf# Compile model failed
[mindspore/lite/src/runtime/c_api/model_c.cc:77] Build# Load and compile failed
复制

converter转换的时候带--inputShape=转换出固定shape的模型,可以正常加载,但是当尝试Resize的时候,又报错了。所以是不支持

[mindspore/lite/src/runtime/sub_graph_kernel.cc:121] ReSize# InferShape failed, type: Reshape
[mindspore/lite/src/runtime/lite_session.cc:1148] ReSizeKernels# ReSize node CpuFP32SubGraph0_0 failed
[mindspore/lite/src/runtime/sub_graph_kernel.cc:121] ReSize# InferShape failed, type: Reshape
[mindspore/lite/src/runtime/lite_session.cc:1148] ReSizeKernels# ReSize node CpuFP32SubGraph0_0 failed
[mindspore/lite/src/runtime/lite_session.cc:1249] Resize# restore kernel size fail!ret: -1
复制

模型使用的是optimum转换出来的whisper tiny的decoder的onnx model。

以下是复现问题的模型,测试条件是使用了OpenHarmony的MindSpore Lite相关API,不过应该正常MindSpore Lite也是能复现的。

****************************************************解答*****************************************************

可以使用lite对应的最新版本试下

Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐