djl icon indicating copy to clipboard operation
djl copied to clipboard

Failed to load PyTorch native library in load_pytorch_model.ipynb

Open melodrama04 opened this issue 2 years ago • 4 comments

In djl.jupyter.load_pytorch_model.ipynb,when I am running " Criteria<Image, Classifications> criteria = Criteria.builder() .setTypes(Image.class, Classifications.class) .optModelPath(Paths.get("build/pytorch_models/resnet18")) .optOption("mapLocation", "false") // this model requires mapLocation for GPU .optTranslator(translator) .optProgress(new ProgressBar()).build();

ZooModel model = criteria.loadModel(); " it gets this information

"

ai.djl.engine.EngineException: Failed to load PyTorch native library at ai.djl.pytorch.engine.PtEngine.newInstance(PtEngine.java:90) at ai.djl.pytorch.engine.PtEngineProvider.getEngine(PtEngineProvider.java:40) at ai.djl.engine.Engine.getEngine(Engine.java:190) at ai.djl.Model.newInstance(Model.java:99) at ai.djl.repository.zoo.BaseModelLoader.createModel(BaseModelLoader.java:191) at ai.djl.repository.zoo.BaseModelLoader.loadModel(BaseModelLoader.java:154) at ai.djl.repository.zoo.Criteria.loadModel(Criteria.java:172) at .(#40:1) "

I didnt change code.

Environment Info

Engines --------------- DJL version: 0.24.0-SNAPSHOT [WARN ] - No matching cuda flavor for win found: cu120mkl/sm_61. [DEBUG] - Using cache dir: C:\Users\guest123.djl.ai\mxnet\1.9.1-mkl-win-x86_64 [INFO ] - Downloading libgcc_s_seh-1.dll ... [INFO ] - Downloading libgfortran-3.dll ... [INFO ] - Downloading libopenblas.dll ... [INFO ] - Downloading libquadmath-0.dll ... [INFO ] - Downloading mxnet.dll ... [DEBUG] - Loading mxnet library from: C:\Users\guest123.djl.ai\mxnet\1.9.1-mkl-win-x86_64\mxnet.dll [WARN ] - No matching cuda flavor for win found: cu120mkl/sm_61. Default Engine: MXNet:1.9.0, capabilities: [ SIGNAL_HANDLER, LAPACK, BLAS_OPEN, OPENMP, OPENCV, MKLDNN, ] MXNet Library: C:\Users\guest123.djl.ai\mxnet\1.9.1-mkl-win-x86_64\mxnet.dll Default Device: cpu() PyTorch: 2 MXNet: 0 XGBoost: 10 LightGBM: 10 OnnxRuntime: 10 TensorFlow: 3

melodrama04 avatar Oct 09 '23 02:10 melodrama04

This is an issue accessing the pytorch binary code that our pytorch engine is built on. Are you import Pytorch at runtime as opposed to through a jar? If so, make sure the notebook can access ~/.djl.ai/pytorch where it will try to cache the native library. See if the file exist there.

Also, there should be another section to the error message

zachgk avatar Oct 10 '23 00:10 zachgk

This is an issue accessing the pytorch binary code that our pytorch engine is built on. Are you import Pytorch at runtime as opposed to through a jar? If so, make sure the notebook can access ~/.djl.ai/pytorch where it will try to cache the native library. See if the file exist there.

Also, there should be another section to the error message

melodrama04 avatar Oct 11 '23 02:10 melodrama04

This is an issue accessing the pytorch binary code that our pytorch engine is built on. Are you import Pytorch at runtime as opposed to through a jar? If so, make sure the notebook can access ~/.djl.ai/pytorch where it will try to cache the native library. See if the file exist there.

Also, there should be another section to the error message

The file exits. And I can run the other notebook in this directory.The problem only happens when I try to run the pytorch one. Up above is all error message I got.

melodrama04 avatar Oct 11 '23 02:10 melodrama04