|
32 | 32 | "- a quick guide to maDLC: https://deeplabcut.github.io/DeepLabCut/docs/tutorial.html\n", |
33 | 33 | "- a demo COLAB for how to use maDLC on your own data: https://github.com/DeepLabCut/DeepLabCut/blob/main/examples/COLAB/COLAB_maDLC_TrainNetwork_VideoAnalysis.ipynb\n", |
34 | 34 | "\n", |
35 | | - "### To get started, please go to \"Runtime\" ->\"change runtime type\"->select \"Python3\", and then select \"GPU\"\n", |
36 | | - "\n", |
37 | | - "As the COLAB environments were updated to CUDA 12.X and Python 3.11, we need to install DeepLabCut and TensorFlow in a distinct way to get TensorFlow to connect to the GPU." |
| 35 | + "### To get started, please go to \"Runtime\" ->\"change runtime type\"->select \"Python3\", and then select \"GPU\"\n" |
38 | 36 | ] |
39 | 37 | }, |
40 | 38 | { |
41 | 39 | "cell_type": "markdown", |
42 | 40 | "source": [ |
43 | | - "‼️ **Attention: this demo is for maDLC, which is version 2.2**\n", |
44 | | - "- the installation is very slow on Colab due to the several steps needed to use older versions of `torch` and `dlc`." |
| 41 | + "‼️ **Attention: this demo is for maDLC, which is version 2.2**\n" |
45 | 42 | ], |
46 | 43 | "metadata": { |
47 | 44 | "id": "xOe2hvy85EVP" |
48 | 45 | } |
49 | 46 | }, |
50 | | - { |
51 | | - "cell_type": "code", |
52 | | - "execution_count": null, |
53 | | - "metadata": { |
54 | | - "id": "6_Q4_GKM45Oe" |
55 | | - }, |
56 | | - "outputs": [], |
57 | | - "source": [ |
58 | | - "# Downgrade PyTorch to a version using CUDA 11.8 and cudnn 8\n", |
59 | | - "# This will also install the required CUDA libraries, for both PyTorch and TensorFlow\n", |
60 | | - "!pip install torch==2.3.1 torchvision --index-url https://download.pytorch.org/whl/cu118" |
61 | | - ] |
62 | | - }, |
63 | | - { |
64 | | - "cell_type": "code", |
65 | | - "source": [ |
66 | | - "import torch\n", |
67 | | - "print(torch.cuda.is_available())\n", |
68 | | - "print(torch.cuda.get_device_name(0))\n", |
69 | | - "!nvcc --version # sometimes not available" |
70 | | - ], |
71 | | - "metadata": { |
72 | | - "colab": { |
73 | | - "base_uri": "https://localhost:8080/" |
74 | | - }, |
75 | | - "id": "3HLeBRGL9jYJ", |
76 | | - "outputId": "b8e49307-f51c-4f12-8dec-d2c2929928e2" |
77 | | - }, |
78 | | - "execution_count": 3, |
79 | | - "outputs": [ |
80 | | - { |
81 | | - "output_type": "stream", |
82 | | - "name": "stdout", |
83 | | - "text": [ |
84 | | - "True\n", |
85 | | - "NVIDIA A100-SXM4-40GB\n", |
86 | | - "nvcc: NVIDIA (R) Cuda compiler driver\n", |
87 | | - "Copyright (c) 2005-2024 NVIDIA Corporation\n", |
88 | | - "Built on Thu_Jun__6_02:18:23_PDT_2024\n", |
89 | | - "Cuda compilation tools, release 12.5, V12.5.82\n", |
90 | | - "Build cuda_12.5.r12.5/compiler.34385749_0\n" |
91 | | - ] |
92 | | - } |
93 | | - ] |
94 | | - }, |
95 | | - { |
96 | | - "cell_type": "code", |
97 | | - "execution_count": null, |
98 | | - "metadata": { |
99 | | - "id": "Vz3B6Zyf45Od" |
100 | | - }, |
101 | | - "outputs": [], |
102 | | - "source": [ |
103 | | - "# Install TensorFlow, tensorpack and tf_slim versions compatible with DeepLabCut\n", |
104 | | - "!pip install \"tensorflow==2.12.1\" \"tensorpack>=0.11\" \"tf_slim>=1.1.0\"" |
105 | | - ] |
106 | | - }, |
107 | | - { |
108 | | - "cell_type": "code", |
109 | | - "execution_count": null, |
110 | | - "metadata": { |
111 | | - "id": "UUpac75T45Of" |
112 | | - }, |
113 | | - "outputs": [], |
114 | | - "source": [ |
115 | | - "# As described in https://www.tensorflow.org/install/pip#step-by-step_instructions,\n", |
116 | | - "# create symbolic links to NVIDIA shared libraries:\n", |
117 | | - "!ln -svf /usr/local/lib/python3.11/dist-packages/nvidia/*/lib/*.so* /usr/local/lib/python3.11/dist-packages/tensorflow" |
118 | | - ] |
119 | | - }, |
120 | 47 | { |
121 | 48 | "cell_type": "code", |
122 | 49 | "execution_count": null, |
|
126 | 53 | "outputs": [], |
127 | 54 | "source": [ |
128 | 55 | "# Install DLC version 2.2-2.3 (pre DLC3):\n", |
129 | | - "!pip install deeplabcut==2.3.11" |
| 56 | + "!pip install \"deeplabcut[tf]\"" |
130 | 57 | ] |
131 | 58 | }, |
132 | 59 | { |
133 | 60 | "cell_type": "code", |
134 | 61 | "source": [ |
135 | | - "import tensorflow\n", |
136 | 62 | "import deeplabcut\n", |
137 | | - "import torch\n", |
138 | 63 | "import os" |
139 | 64 | ], |
140 | 65 | "metadata": { |
|
143 | 68 | "execution_count": 3, |
144 | 69 | "outputs": [] |
145 | 70 | }, |
146 | | - { |
147 | | - "cell_type": "code", |
148 | | - "source": [ |
149 | | - "print(\"DLC version: \", deeplabcut.__version__)\n", |
150 | | - "print(\"torch version: \",torch.__version__)\n", |
151 | | - "print(\"tensorflow version: \",tensorflow.__version__)\n" |
152 | | - ], |
153 | | - "metadata": { |
154 | | - "colab": { |
155 | | - "base_uri": "https://localhost:8080/" |
156 | | - }, |
157 | | - "id": "wRojzQO98X2H", |
158 | | - "outputId": "fad889d6-15da-4888-8138-283f1f13cf99" |
159 | | - }, |
160 | | - "execution_count": 4, |
161 | | - "outputs": [ |
162 | | - { |
163 | | - "output_type": "stream", |
164 | | - "name": "stdout", |
165 | | - "text": [ |
166 | | - "DLC version: 2.3.11\n", |
167 | | - "torch version: 2.3.1+cu118\n", |
168 | | - "tensorflow version: 2.12.1\n" |
169 | | - ] |
170 | | - } |
171 | | - ] |
172 | | - }, |
173 | 71 | { |
174 | 72 | "cell_type": "markdown", |
175 | 73 | "metadata": { |
|
0 commit comments