I'm using an imx8mn-evk and I'm using this reference manual: IMX-MACHINE-LEARNING-UG.pdf
I tried to run the PyTorch example pytorch_mobilenetv2.py from the imx-image-full but I got the following error:
" root@imx8mnevk:/usr/bin/pytorch/examples# python3 pytorch_mobilenetv2.py
Traceback (most recent call last):
File "pytorch_mobilenetv2.py", line 7, in <module>
import torch
File "/usr/lib/python3.7/site-packages/torch/__init__.py", line 190, in <module>
from torch._C import *
ImportError: /lib/libc.so.6: version `GLIBC_2.32' not found (required by /usr/lib/python3.7/site-packages/torch/lib/libtorch_python.so) "
I have downloaded that version, 2.32 in this way:
wget http://ftp.gnu.org/gnu/glibc/glibc-2.32.tar.gz tar zxvf glibc-2.32.tar.gz cd glibc-2.32 mkdir build cd build ../configure --prefix=/opt/glibc-2.32 make -j4 sudo make install export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/glibc-2.32/lib
However, it did not work.
I guess LD_LIBRARY is not correctly installed but I can't find the error.
Has anyone worked with Pytorch before, and know how to make it run?
Thank you.
Hi,
Got to this ticket while investigating a similar issue. A couple of comments:
1. This is a known issue, fixed in LF5.10.x. A workaround for 5.4.x is to reinstall the wheel pkgs.
https://github.com/NXPmicro/pytorch-release/tree/imx_5.4.47_2.2.0/whl/torch-1.6.0-cp37-cp37m-linux_a...
https://github.com/NXPmicro/pytorch-release/tree/imx_5.4.47_2.2.0/whl/torchvision-0.7.0-cp37-cp37m-linux_aarch64.whl
2. eIQ in general, and the example's in the ML User's guide are supported across all i.MX 8 family, not just 8MP. Depending on the platform, the ML compute unit can be different (e.g., for 8MPlus: NPU, GPU or CPU; for 8MNano: CPU). This compute unit can be set through a flag at runtime; for now pytorch only supports the CPU.
Regards,
Raluca
Many thanks for your answer.
I have been trying an other alternative: I installed Pytorch in my imx-image-core, first, the version was 1.9.0, wich I got a message about an "Ilegal Instruction" and I achieved to fixed it changing the version to a lower one (1.8.0), however, it was not completely succesful due to this warning: "OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option"
Would you know about any more solution to include Pytorch packages to my image in the IMX8mn-evk?
Thanks in advance, I will be waIting for news ASAP.