The Jetson Nano board from NVIDIA TensorRT Version: 8.0.1.6 GPU Type: GPU present on the Jetson Nano board Nvidia Driver Version: -NA- CUDA Version: -NA- CUDNN Version: -NA- Operating System + Version: Linux ubuntu 4.9.253-tegra #2 SMP PREEMPT Tue Nov 29 18:32:41 IST 2022 aarch64 aarch64 aarch64 GNU/Linux Python Version (if applicable): 3.6 TensorFlow Version (if applicable): -NA- PyTorch Version (if applicable): -NA- Baremetal or Container (if container which image + tag): -NA-
Relevant Files
Files uploaded are
pytorch_tensorrt.py and resnet_engine_pytorch_fp16.trt
The file resnet_engine_pytorch_fp16.trt is created using trtexec command on the jetson nano from the onnx file resnet50_pytorch.onnx
The onnx model is created using the link which is present in the attached file link.txt link.txt (185 Bytes)
The trtexec command is used as below
trtexec --onnx=resnet50_pytorch.onnx --saveEngine=resnet_engine_pytorch_fp16.trt --explicitBatch --inputIOFormats=fp16:chw --outputIOFormats=fp16:chw --fp16 resnet_engine_pytorch_fp16.trt (49.3 MB) pytorch_to_tensorrt.py (322 Bytes)
Steps To Reproduce
Place the file resnet_engine_pytorch_fp16.trt in the same directory where the script pytorch_tensorrt.py is present
Execute the script with the command
python3.6 pytorch_tensorrt.py
Thanks Aakanksha. I need to one more help, the link which you have provided makes use of importing the torch as
import torch
from torch2trt import torch2trt
May I know how to install the pytorch on the jetson nano board so that I won’t get any errors. Otherwise I get into fixing these issues.
I am doing all these activities as part of writing a Master’s thesis on “Accelerating DL Inference Performance On the Embedded IoT platform” . For this I have chosen Jetson Nano board. I have very limited free time as I am a working professional. It will be helpful if you arrange me a direct chatting with any NVIDIA engineer or direct email ID so that it will speed up my work.
Hi AastaLLL, I have followed the steps explained in the link you have provided. But at the end it has thrown this error. May I know what could be the reason.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.6/site-packages (21.3.1)
Defaulting to user installation because normal site-packages is not writeable
ERROR: Invalid requirement: ‘LD_LIBRARY_PATH=/usr/lib/llvm-8/lib:/usr/local/cuda-10.2/lib64{LD_LIBRARY_PATH:+:}’
Hint: It looks like a path. File ‘LD_LIBRARY_PATH=/usr/lib/llvm-8/lib:/usr/local/cuda-10.2/lib64{LD_LIBRARY_PATH:+:}’ does not exist.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: protobuf in ./.local/lib/python3.6/site-packages (3.19.6)
Defaulting to user installation because normal site-packages is not writeable
ERROR: torch-2.0.0a0+fe05266f.nv23.04-cp38-cp38-linux_aarch64.whl is not a supported wheel on this platform.
Hi AastaLLL, thank you for the suggestion. It got installed. But I am facing one more issue that when I tried verifying using the command
python3
import torch
It gave a user warning
/home/mistral/.local/lib/python3.6/site-packages/torch/_masked/init.py:223: UserWarning: Failed to initialize NumPy: No module named ‘numpy.core._multiarray_umath’ (Triggered internally at /opt/package_build/pytorch/torch/csrc/utils/tensor_numpy.cpp:68.)
example_input = torch.tensor([[-3, -2, -1], [0, 1, 2]])
Will that be OK to ignore it OR do I need to install another version of numpy to be compatible with this.
Please let me know.
It installed the pytorch. After that I tried installing the torchversion required for it through the following steps. But it gives error while running the setup,py script as OSError: libomp.so: cannot open shared object file: No such file or directory
Below are the commands executed to get above error. Also is there any any link to install the appropriate torchvision version?
Traceback (most recent call last):
File “setup.py”, line 14, in
import torch
File “/home/mistral/.local/lib/python3.6/site-packages/torch/init.py”, line 198, in
_load_global_deps()
File “/home/mistral/.local/lib/python3.6/site-packages/torch/init.py”, line 151, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File “/usr/lib/python3.6/ctypes/init.py”, line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: libomp.so: cannot open shared object file: No such file or directory