Skip to content

Instantly share code, notes, and snippets.

@piroyon
Last active June 30, 2023 04:11
Show Gist options
  • Save piroyon/98e95515c905212e8b0f4d4e175fbfd5 to your computer and use it in GitHub Desktop.
Save piroyon/98e95515c905212e8b0f4d4e175fbfd5 to your computer and use it in GitHub Desktop.
AWS G4dn + Deeplabcut 2.2.3 (Dec. 2022)
## AMI : ubuntu 22.04 (not use Deep Learning AMI) + EBS 30Gb
## INSTANCE : g4dn.4xlarge
$ sudo apt update
$ sudo apt install nvidia-driver-515 #(530 : /25/May/2023)
$ sudo apt install nvidia-cuda-toolkit
$ sudo apt install nvidia-utils-515 #(530 : /25/May/2023)
$ sudo reboot
$ nvidia-smi
Thu Dec 1 05:57:02 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla T4 Off | 00000000:00:1E.0 Off | 0 |
| N/A 79C P0 70W / 70W | 2MiB / 15360MiB | 97% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
$ sudo apt-get install python3-wxgtk4.0
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
$ sudo pip3 install deeplabcut[tf]
$ sudo pip3 install tensorflow==2.11.1
$ sudo pip3 install tensorrt
$ cd /usr/lib
$ sudo ln -s /usr/local/lib/python3.10/dist-packages/tensorrt/libnvinfer.so.8 libnvinfer.so.7
$ sudo ln -s /usr/local/lib/python3.10/dist-packages/tensorrt/libnvinfer_plugin.so.8 libnvinfer_plugin.so.7
# OR
$ sudo ln -s /usr/local/lib/python3.10/dist-packages/tensorrt_libs/libnvinfer.so.8 libnvinfer.so.7
$ sudo ln -s /usr/local/lib/python3.10/dist-packages/tensorrt_libs/libnvinfer_plugin.so.8 libnvinfer_plugin.so.7
$ sudo ln -s /usr/local/lib/python3.10/dist-packages/nvidia/cudnn/lib/libcudnn* .
$ sudo ln -s /usr/local/lib/python3.10/dist-packages/nvidia/cublas/lib/libcublas* .
## Download "resnet_v1_50.ckpt"
## DO NOT USE wget!!
## https://github.com/serre-lab/deeplabcut_mgh/blob/master/deeplabcut/pose_estimation_tensorflow/models/pretrained/resnet_v1_50.ckpt
$ sudo mv resnet_v1_50.ckpt /usr/local/lib/python3.10/dist-packages/deeplabcut/pose_estimation_tensorflow/models/pretrained/
## TEST
$ python3
Python 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import deeplabcut
2022-12-01 05:59:51.134744: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F AVX512_VNNI FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-12-01 05:59:51.277338: I tensorflow/core/util/port.cc:104] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
Loading DLC 2.2.3...
# If the CUDA version is 11, then nvidia-cudnn installed with pip3 must also be for 11.
# sudo pip3 uninstall nvidia-cuda-runtime-cu12
# sudo pip3 uninstall nvidia-cuda-cublas-cu12
# sudo pip3 uninstall nvidia-cudnn-cu12
# sudo pip3 install nvidia-cuda-runtime-cu11
# sudo pip3 install nvidia-cuda-cublas-cu11
# sudo pip3 install nvidia-cudnn-cu11
# INSTALL CUDAnn from NVIDIA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment