deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.07k stars 650 forks source link

Training model failed #2072

Closed liudaolunboluo closed 1 year ago

liudaolunboluo commented 1 year ago

Description

when I run Mnist mnist = Mnist.builder().setSampling(batchSize, true).build();

report errors: Exception in thread "main" ai.djl.engine.EngineException: Failed to load MXNet native library at ai.djl.mxnet.engine.MxEngine.newInstance(MxEngine.java:78) at ai.djl.mxnet.engine.MxEngineProvider.getEngine(MxEngineProvider.java:40)

dlopen(/Users/.djl.ai/mxnet/1.8.0-mkl-osx-aarch64/libmxnet.dylib, 0x0009): tried: '/Users/zhangyunfan/.djl.ai/mxnet/1.8.0-mkl-osx-aarch64/libmxnet.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))) dlopen(/Users/.djl.ai/mxnet/1.8.0-mkl-osx-aarch64/libmxnet.dylib, 0x0009): tried: '/Users/zhangyunfan/.djl.ai/mxnet/1.8.0-mkl-osx-aarch64/libmxnet.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

frankfliu commented 1 year ago

@liudaolunboluo MXNet doesn't support mac M1. You can try to switch to PyTorch engine to run the example:

cd examples:
./gradlew run -Dmain=ai.djl.examples.training.TrainMnist -Dai.djl.default_engine=PyTorch
liudaolunboluo commented 1 year ago

@liudaolunboluo MXNet doesn't support mac M1. You can try to switch to PyTorch engine to run the example:

cd examples:
./gradlew run -Dmain=ai.djl.examples.training.TrainMnist -Dai.djl.default_engine=PyTorch

yes,I solved this problem,I remove MXNet dependence,very thank you