djl icon indicating copy to clipboard operation
djl copied to clipboard

关于aarch64 onnx无法加载的问题

Open 90600 opened this issue 2 years ago • 4 comments

我描述一下我的问题,有两个基础docker镜像,一个是x86另一个是arm架构的,里面环境是一样的就是Java和tomcat,同一份代码,在x86里可以正常使用,arm里就是一直报加载错误,onnx引擎都下下来了,这个问题我改如何解决呢

可以看下图片所需要的引擎都下载下来了 image

主要错误: 1.Caused by: java.lang.UnsatisfiedLinkError: Unable to load library '/root/.djl.ai/mxnet/1.9.1-mkl-linux-aarch64/libmxnet.so': 2.Caused by: ai.djl.engine.EngineException: Failed to load MXNet native library

想请问下,我aarch64架构是缺少啥东西么?

90600 avatar Oct 15 '23 07:10 90600

@90600

MXNet doesn't support aarch64. Only PyTorch and OnnxRuntime works for aarch64. Please make sure only include onnx and pytorch engine in your project.

frankfliu avatar Oct 15 '23 07:10 frankfliu

首先谢谢你可以回答我的问题。 我把模型换成pytorch引擎后,在aarch64环境里可以正常运行了,但是推理特别慢,需要3~6秒,推理一张图片。 在本地运行并没有这么慢,是服务器的问题么

90600 avatar Oct 15 '23 11:10 90600

我使用OnnxRuntime进行推理,报错java.lang.UnsupportedOperationException: This NDArray implementation does not currently support this operation

我的maven依赖 image

我还需要引入别的相关依赖么

90600 avatar Oct 15 '23 12:10 90600

@90600 We didn't observe performance issue on aarch64 machine. It actually running a bit faster on AWS graviton3 instance. It might be related to your linux environment missing some math library. You can enable Metrics to see where the time spend on.

For OnnxRuntime, it doesn't support NDArray operations, you need use it with PyTorch together. See: https://docs.djl.ai/master/docs/hybrid_engine.html

frankfliu avatar Oct 15 '23 17:10 frankfliu