0. 개요
이전 글에서 jetson의 docker image에 대한 글을 남겼습니다.
이번 글에서는 Deep Learing과 관련한 Jetson의 docker image에 대해 사용하는 방법들을 정리해보고자 합니다.
1. 환경
실험 환경은 아래와 같습니다.
Jetson AGX Xavier
Jetpack 4.5 (Ubuntu 18.04)
위 환경에서는 docker가 기본적으로 설치되어있고,
따라서 아래의 명령들을 따라하시면 됩니다.
2. Docker Images 설명
The l4t-ml docker image contains TensorFlow, PyTorch, JupyterLab, and other popular ML and data science frameworks such as scikit-learn, scipy, and Pandas pre-installed in a Python 3.6 environment. These containers support the following releases of JetPack for Jetson Nano, TX1/TX2, Xavier NX, and AGX Xavier:
- JetPack 4.6 (L4T R32.6.1)
- JetPack 4.5 (L4T R32.5.0)
- JetPack 4.4.1 (L4T R32.4.4)
- JetPack 4.4 (L4T R32.4.3)
- JetPack 4.4 Developer Preview (L4T R32.4.2)
For additional machine learning containers for Jetson, see the l4t-pytorch and l4t-tensorflow images. Note that the TensorFlow and PyTorch pip wheel installers for aarch64 are available to download independently from the Jetson Zoo.
Package Versions
Depending on your version of JetPack-L4T, different tags of the l4t-ml container are available, each with support for Python 3.6. Be sure to clone a tag that matches the version of JetPack-L4T that you have installed on your Jetson.
- JetPack 4.6 (L4T R32.6.1)
- l4t-ml:r32.6.1-py3
- TensorFlow 1.15.5
- PyTorch v1.9.0
- torchvision v0.10.0
- torchaudio v0.9.0
- onnx 1.8.0
- CuPy 9.2.0
- numpy 1.19.5
- numba 0.53.1
- OpenCV 4.5.0 (with CUDA)
- pandas 1.1.5
- scipy 1.5.4
- scikit-learn 0.23.2
- JupyterLab 2.2.9
- l4t-ml:r32.6.1-py3
- JetPack 4.5 (L4T R32.5.0)
- l4t-ml:r32.5.0-py3
- TensorFlow 1.15
- PyTorch v1.7.0
- torchvision v0.8.0
- torchaudio v0.7.0
- onnx 1.8.0
- CuPy 8.0.0
- numpy 1.19.4
- numba 0.52.0
- OpenCV 4.1.1
- pandas 1.1.5
- scipy 1.5.4
- scikit-learn 0.23.2
- JupyterLab 2.2.9
- l4t-ml:r32.5.0-py3
- JetPack 4.4.1 (L4T R32.4.4)
- l4t-ml:r32.4.4-py3
- TensorFlow 1.15
- PyTorch v1.6.0
- torchvision v0.7.0
- torchaudio v0.6.0
- onnx 1.7.0
- CuPy 8.0.0
- numpy 1.19.2
- numba 0.51.2
- pandas 1.1.3
- scipy 1.5.3
- scikit-learn 0.23.2
- JupyterLab 2.2.8
- l4t-ml:r32.4.4-py3
- JetPack 4.4 (L4T R32.4.3)
- l4t-ml:r32.4.3-py3
- TensorFlow 1.15
- PyTorch v1.6.0
- torchvision v0.7.0
- torchaudio v0.6.0
- onnx 1.7.0
- CuPy 8.0.0
- numpy 1.19.0
- numba 0.50.0
- pandas 1.0.5
- scipy 1.5.0
- scikit-learn 0.23.1
- JupyterLab 2.1.5
- l4t-ml:r32.4.3-py3
- JetPack 4.4 Developer Preview (L4T R32.4.2)
- l4t-ml:r32.4.2-py3
- TensorFlow 1.15
- PyTorch v1.5.0
- torchvision v0.6.0
- onnx 1.6.0
- numpy 1.18.2
- pandas 1.0.3
- scipy 1.4.1
- scikit-learn 0.22.2
- JupyterLab 2.0.1
- l4t-ml:r32.4.2-py3
note: the l4t-ml containers require JetPack 4.4 or newer
3. 실행
1) 초기 상태에서는 docker images가 없고 따라서 실행된 container도 없는 것을 확인할 수 있습니다.
- docker images 체크
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
- docker container 목록 확인
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2) docker image pull
docker image를 다운받습니다.
위의 원하는 환경을 선택하여 아래와 같은 명령을 실행하면 됩니다.
- docker pull
$ sudo docker pull nvcr.io/nvidia/l4t-ml:r32.6.1-py3
r32.6.1-py3: Pulling from nvidia/l4t-ml
e47a8a86d66c: Pulling fs layer
bdce3430dad6: Pull complete
c26a6b81c746: Pull complete
a70635e646de: Pull complete
24cbe60e3161: Pull complete
c7f64cc97a39: Pull complete
8777adb92eda: Pull complete
542a24b3572f: Pull complete
3d5ade2b8849: Pull complete
3e865584f789: Pull complete
4811af6cacf1: Pull complete
db645757aac7: Pull complete
0105dc23dc93: Pull complete
c8aff3baf097: Pull complete
5f50b3e38480: Pull complete
b5418d85b074: Pull complete
d09ffaf0f11a: Pull complete
f1cf5625978f: Pull complete
514fd4c3f8c5: Pull complete
0988d0ccf8a6: Pull complete
ffce97733d6c: Pull complete
80d5eedfe895: Pull complete
d19792019860: Pull complete
3ee7b31a8890: Pull complete
8aca18eb38a5: Pull complete
153000266b1a: Pull complete
23bf7741f5d8: Pull complete
d03fa2111a1c: Pull complete
095c23b57578: Pull complete
2de9347ccaf2: Pull complete
0f26c4b0a765: Pull complete
ee3bc588c8ee: Pull complete
aa25eb953d98: Pull complete
97fd80a69cc6: Pull complete
Digest: sha256:1f4ef02343223cab6bbe5bf85d5575364b7ee0ee23d72c2e3b89416ca3806f7e
Status: Downloaded newer image for nvcr.io/nvidia/l4t-ml:r32.6.1-py3
nvcr.io/nvidia/l4t-ml:r32.6.1-py3
- 다운받은 docker image 확인
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nvcr.io/nvidia/l4t-ml r32.6.1-py3 4818848f7fee 7 weeks ago 5GB
- 만약 docker image를 지우고 싶다면, 아래의 명령을 실행하면 됩니다.
$ sudo docker rmi nvcr.io/nvidia/l4t-ml:r32.6.1-py3
3) docker images run
아래의 명령을 통해 docker를 실행할 수 있습니다.
그리고 다음과 같이 container의 파일 리스트를 볼 수 있습니다.
- docker run
# 1st terminal
$ sudo docker run -it --rm --runtime nvidia --network host nvcr.io/nvidia/l4t-ml:r32.6.1-py3
allow 10 sec for JupyterLab to start @ http://192.168.0.8:8888 (password nvidia)
JupterLab logging location: /var/log/jupyter.log (inside the container)
root@user:/# ls
bin boot dev dst etc home lib media mnt opt proc root run sbin srv sys tmp usr var
- docker container 목록 확인
# 2nd terminal
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6312284f77b nvcr.io/nvidia/l4t-ml:r32.6.1-py3 "/bin/sh -c '/bin/ba…" About a minute ago Up About a minute condescending_jones
그리고 위 docker run 명령으로 jupyterlab 서버를 실행시키고
아래와 같이 접속이 가능합니다.
http://localhost:8888
password : nvidia
만약 host device에서 데이터나 파일들을 mount하기 위해서는 아래와 같이 -v flag를 사용하면 됩니다.
- mounting directories
$ sudo docker run -it --rm --runtime nvidia --network host -v /home/user/project:/location/in/container nvcr.io/nvidia/l4t-ml:r32.6.1-py3
container를 강제 종료시키기 위해서는 아래의 명령을 실행 합니다.
- docker rm -f
# 2nd terminal
$ sudo docker rm -f c6312284f77b
c6312284f77b
- docker container 목록 확인
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ref.
https://ngc.nvidia.com/catalog/containers/nvidia:l4t-ml
NVIDIA NGC
ngc.nvidia.com
이것뿐만 아니라
pythorch와 tensorflow에 대한 docker images는 다음과 같습니다.
Extra 1. pytorch images
Depending on your version of JetPack-L4T, different tags of the l4t-pytorch container are available, each with support for Python 3.6. Be sure to clone a tag that matches the version of JetPack-L4T that you have installed on your Jetson.
- JetPack 4.6 (L4T R32.6.1)
- l4t-pytorch:r32.6.1-pth1.9-py3
- PyTorch v1.9.0
- torchvision v0.10.0
- torchaudio v0.9.0
- l4t-pytorch:r32.6.1-pth1.8-py3
- PyTorch v1.8.0
- torchvision v0.9.0
- torchaudio v0.8.0
- l4t-pytorch:r32.6.1-pth1.9-py3
- JetPack 4.5 (L4T R32.5.0)
- l4t-pytorch:r32.5.0-pth1.7-py3
- PyTorch v1.7.0
- torchvision v0.8.0
- torchaudio v0.7.0
- l4t-pytorch:r32.5.0-pth1.6-py3
- PyTorch v1.6.0
- torchvision v0.7.0
- torchaudio v0.6.0
- l4t-pytorch:r32.5.0-pth1.7-py3
- JetPack 4.4.1 (L4T R32.4.4)
- l4t-pytorch:r32.4.4-pth1.6-py3
- PyTorch v1.6.0
- torchvision v0.7.0
- torchaudio v0.6.0
- l4t-pytorch:r32.4.4-pth1.6-py3
- JetPack 4.4 (L4T R32.4.3)
- l4t-pytorch:r32.4.3-pth1.6-py3
- PyTorch v1.6.0
- torchvision v0.7.0
- torchaudio v0.6.0
- l4t-pytorch:r32.4.3-pth1.6-py3
- JetPack 4.4 Developer Preview (L4T R32.4.2)
- l4t-pytorch:r32.4.2-pth1.5-py3
- PyTorch v1.5.0
- torchvision v0.6.0
- l4t-pytorch:r32.4.2-pth1.4-py3
- PyTorch v1.4.0
- torchvision v0.5.0
- l4t-pytorch:r32.4.2-pth1.3-py3
- PyTorch v1.3.0
- torchvision v0.4.2
- l4t-pytorch:r32.4.2-pth1.2-py3
- PyTorch v1.2.0
- torchvision v0.4.0
- l4t-pytorch:r32.4.2-pth1.5-py3
note: the l4t-pytorch containers require JetPack 4.4 or newer
ref.
https://ngc.nvidia.com/catalog/containers/nvidia:l4t-pytorch
NVIDIA NGC
ngc.nvidia.com
Extra 2. tensorflow images
Depending on your version of JetPack-L4T, different tags of the l4t-tensorflow container are available, each with support for Python 3.6. Be sure to clone a tag that matches the version of JetPack-L4T that you have installed on your Jetson.
- JetPack 4.6 (L4T R32.6.1)
- l4t-tensorflow:r32.6.1-tf1.15-py3
- TensorFlow 1.15.5
- TensorFlow 1.15.5
- l4t-tensorflow:r32.6.1-tf2.5-py3
- TensorFlow 2.5.0
- l4t-tensorflow:r32.6.1-tf1.15-py3
- JetPack 4.5 (L4T R32.5.0)
- l4t-tensorflow:r32.5.0-tf1.15-py3
- TensorFlow 1.15
- TensorFlow 1.15
- l4t-tensorflow:r32.5.0-tf2.3-py3
- TensorFlow 2.3.1
- l4t-tensorflow:r32.5.0-tf1.15-py3
- JetPack 4.4.1 (L4T R32.4.4)
- l4t-tensorflow:r32.4.4-tf1.15-py3
- TensorFlow 1.15
- TensorFlow 1.15
- l4t-tensorflow:r32.4.4-tf2.3-py3
- TensorFlow 2.3
- l4t-tensorflow:r32.4.4-tf1.15-py3
- JetPack 4.4 (L4T R32.4.3)
- l4t-tensorflow:r32.4.3-tf1.15-py3
- TensorFlow 1.15
- TensorFlow 1.15
- l4t-tensorflow:r32.4.3-tf2.2-py3
- TensorFlow 2.2
- l4t-tensorflow:r32.4.3-tf1.15-py3
- JetPack 4.4 Developer Preview (L4T R32.4.2)
- l4t-tensorflow:r32.4.2-tf1.15-py3
- TensorFlow 1.15
- l4t-tensorflow:r32.4.2-tf1.15-py3
note: the l4t-tensorflow containers require JetPack 4.4 or newer
ref.
https://ngc.nvidia.com/catalog/containers/nvidia:l4t-tensorflow
NVIDIA NGC
ngc.nvidia.com
https://developer.nvidia.com/embedded/jetson-cloud-native
Cloud-Native on Jetson
Cloud-Native technologies offer the flexibility and agility needed for rapid product development and continual product upgrades. Jetson brings Cloud-Native to the edge and enables technologies like containers and container orchestration which revolutionize
developer.nvidia.com