Hello and thank you for your quick answer!
I saw it already 2 days ago, but didn’t want to answer so the topic wouldn’t be closed. Indeed as you said the image was incorrect. I will answer below, also for others, what my steps were to run trt_pose model inside a container on Jatson nano (NOTE: still not perfect!).
I checked my l4t version using cat /etc/nv_tegra_release
which printed: R32 (release), REVISION: 7.1. Then I checked on this page: NVIDIA L4T ML | NVIDIA NGC to see which version of ml image I need to use - I, therefore, needed JetPack 4.6.1 (L4T R32.7.1).
Then I created Dockerfile with name Dockerfile.jetson
:
ARG TAG
FROM nvcr.io/nvidia/l4t-ml:${TAG}
# Install any utils needed for execution
RUN apt-get update \
&& apt-get install -y --no-install-recommends sudo \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
RUN sudo pip3 install tqdm cython pycocotools \
&& sudo apt-get install python3-matplotlib
WORKDIR /app
RUN if [ -d /app/torch2trt ]; then \
echo "torch2trt already cloned."; \
else \
git clone --depth 1 https://github.com/NVIDIA-AI-IOT/torch2trt \
&& cd torch2trt \
&& sudo python3 setup.py install --plugins; \
fi
RUN if [ -d /app/trt_pose ]; then \
echo "trt_pose already cloned."; \
else \
git clone --depth 1 https://github.com/NVIDIA-AI-IOT/trt_pose \
&& cd trt_pose \
&& sudo python3 setup.py install; \
fi
and Makefile (TAG adjusted based on version of l4t):
TAG ?= r32.7.1-py3
L4T_JETPACK_REGISTRY ?= "nvcr.io/nvidia/l4t-ml"
image:
docker build -t $(L4T_JETPACK_REGISTRY):$(TAG) \
--build-arg "TAG=$(TAG)" \
-f ./Dockerfile.jetson .
run:
docker run -it --rm --runtime nvidia --network host \
-e DISPLAY=$(DISPLAY) \
-v /tmp/.X11-unix/:/tmp/.X11-unix $(L4T_JETPACK_REGISTRY):$(TAG)
all:
sudo make image ; sudo make run
Then I call sudo make all
which pull the base image, builds and runs the container. Everything looks fine and I am able to run the model with 8 FPS - less than the stated 22 by using appended script in the repo: trt_pose/tasks/human_pose/live_demo.ipynb
.
I think something is still wrong, because during the execution of line:
model_trt = torch2trt.torch2trt(model, [data], fp16_mode=True, max_workspace_size=1<<25)
is throwing the error [E] 3: [builderConfig.cpp::canRunOnDLA::382] Error Code 3: API Usage Error (Parameter check failed at: optimizer/api/builderConfig.cpp::canRunOnDLA::382, condition: dlaEngineCount > 0
- while the original torch model is being optimized.
Also, the line where the model should be saved:
torch.Savemodel_trt.state_dict(), OPTIMIZED_MODEL)
throws the error:
Traceback (most recent call last):
File "trt.py", line 74, in <module>
torch.save(model_trt.state_dict(), OPTIMIZED_MODEL)
File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 379, in save
_save(obj, opened_zipfile, pickle_module, pickle_protocol)
File "/usr/local/lib/python3.6/dist-packages/torch/serialization.py", line 484, in _save
pickler. Dump(obj)
MemoryError
Any idea how I should tackle this? Thank you in advance!