|
3 | 3 | "nbformat_minor": 0, |
4 | 4 | "metadata": { |
5 | 5 | "colab": { |
6 | | - "name": "Copy of Copy of pytorch_cpp_colab_notebook.ipynb", |
7 | 6 | "private_outputs": true, |
8 | 7 | "provenance": [], |
9 | | - "collapsed_sections": [ |
10 | | - "VbwYTgxWvfMD" |
11 | | - ], |
12 | 8 | "toc_visible": true |
13 | 9 | }, |
14 | 10 | "kernelspec": { |
|
27 | 23 | "\n", |
28 | 24 | "\n", |
29 | 25 | "\n", |
30 | | - "This notebook is intended to be used on [Google Colab](https://colab.research.google.com). It allows you\n", |
| 26 | + "* **This notebook is intended to be used on [Google Colab](https://colab.research.google.com) ONLY!** \n", |
| 27 | + "* It allows you\n", |
31 | 28 | "to build and run the [pytorch-cpp](https://github.com/prabhuomkar/pytorch-cpp) tutorials on a hosted GPU equipped system for free." |
32 | 29 | ] |
33 | 30 | }, |
|
138 | 135 | "id": "cs1nFZkH59Nb" |
139 | 136 | }, |
140 | 137 | "source": [ |
141 | | - "##Install more recent CMake Version" |
| 138 | + "##Install more recent versions of dependencies and build tools\n", |
| 139 | + "(This takes several minutes)" |
142 | 140 | ] |
143 | 141 | }, |
144 | 142 | { |
145 | 143 | "cell_type": "code", |
146 | | - "metadata": { |
147 | | - "id": "m2Lf4RSjou6t" |
148 | | - }, |
149 | 144 | "source": [ |
| 145 | + "# Update CUDA \n", |
| 146 | + "!wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin\n", |
| 147 | + "!sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600\n", |
| 148 | + "!wget https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda-repo-ubuntu1804-11-6-local_11.6.0-510.39.01-1_amd64.deb\n", |
| 149 | + "!sudo dpkg -i 'cuda-repo-ubuntu1804-11-6-local_11.6.0-510.39.01-1_amd64.deb'\n", |
| 150 | + "!sudo apt-key add /var/cuda-repo-ubuntu1804-11-6-local/7fa2af80.pub\n", |
| 151 | + "!sudo apt-get update\n", |
| 152 | + "!sudo DEBIAN_FRONTEND=noninteractive apt-get -y install cuda-11-6\n", |
| 153 | + "!sudo cp /usr/include/x86_64-linux-gnu/cudnn*.h /usr/local/cuda-11.6/include\n", |
| 154 | + "!sudo cp /usr/lib/x86_64-linux-gnu/libcudnn* /usr/local/cuda-11.6/lib64\n", |
| 155 | + "!sudo chmod a+r /usr/local/cuda-11.6/include/cudnn*.h /usr/local/cuda-11.6/lib64/libcudnn*\n", |
| 156 | + "old_ld_library_path = %env LD_LIBRARY_PATH\n", |
| 157 | + "new_ld_library_path = \"/usr/local/cuda-11.6/lib64:\" + old_ld_library_path\n", |
| 158 | + "%env LD_LIBRARY_PATH={new_ld_library_path}\n", |
| 159 | + "%env CUDA_HOME=/usr/local/cuda-11.6\n", |
| 160 | + "\n", |
| 161 | + "# Update CMake\n", |
150 | 162 | "!rm -rf deps\n", |
151 | 163 | "!mkdir deps\n", |
152 | 164 | "%cd /content/deps\n", |
|
157 | 169 | "new_path = \"/content/deps/cmake-install:/content/deps/cmake-install/bin:\" + old_path\n", |
158 | 170 | "%env PATH={new_path}\n", |
159 | 171 | "%cd /content/\n", |
160 | | - "!cmake --version" |
| 172 | + "!cmake --version\n", |
| 173 | + "\n", |
| 174 | + "# Update g++\n", |
| 175 | + "!sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y\n", |
| 176 | + "!sudo apt-get update\n", |
| 177 | + "!sudo apt-get install gcc-10 g++-10 -y\n", |
| 178 | + "!sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10" |
161 | 179 | ], |
| 180 | + "metadata": { |
| 181 | + "id": "yS5dYChCtqzP" |
| 182 | + }, |
162 | 183 | "execution_count": null, |
163 | 184 | "outputs": [] |
164 | 185 | }, |
|
189 | 210 | "echo \"\"\n", |
190 | 211 | "pip show torchvision\n", |
191 | 212 | "echo \"\"\n", |
192 | | - "# GPU Informations\n", |
193 | | - "nvidia-smi" |
| 213 | + "# CUDA Information\n", |
| 214 | + "nvcc --version" |
194 | 215 | ], |
195 | 216 | "execution_count": null, |
196 | 217 | "outputs": [] |
|
232 | 253 | "id": "rbeD5lKStWhS" |
233 | 254 | }, |
234 | 255 | "source": [ |
| 256 | + "%cd /content/pytorch-cpp\n", |
235 | 257 | "%rm -rf build\n", |
236 | | - "!cmake -B build -D CUDA_V=11.1 -D CMAKE_BUILD_TYPE=Release" |
| 258 | + "!cmake -B build -D CUDA_V=11.6 -D CMAKE_BUILD_TYPE=Release" |
237 | 259 | ], |
238 | 260 | "execution_count": null, |
239 | 261 | "outputs": [] |
|
253 | 275 | "id": "H-n_1d4Mt8MG" |
254 | 276 | }, |
255 | 277 | "source": [ |
| 278 | + "%cd /content/pytorch-cpp\n", |
256 | 279 | "!cmake --build build" |
257 | 280 | ], |
258 | 281 | "execution_count": null, |
|
273 | 296 | "* [Feedforward Neural Network](#scrollTo=ywmM2xkt1mi0)\n", |
274 | 297 | "\n", |
275 | 298 | "### 2. Intermediate\n", |
276 | | - "* [Convolutional Neural Network](#scrollTo=2gjZC6b_2PEz)\n", |
| 299 | + "* [Convolutional Neural Network](#scrollTo=Convolutional_Neural_Network)\n", |
277 | 300 | "* [Deep Residual Network](#scrollTo=Kla2SaVv228f)\n", |
278 | 301 | "* [Recurrent Neural Network](#scrollTo=aTrOcUke3Zxu)\n", |
279 | 302 | "* [Bidirectional Recurrent Neural Network](#scrollTo=FVVx0XFY3yvU)\n", |
|
322 | 345 | }, |
323 | 346 | "source": [ |
324 | 347 | "# Create required torchscript module:\n", |
325 | | - "%cd /content/pytorch-cpp/tutorials/basics/pytorch_basics/models/\n", |
| 348 | + "%cd /content/pytorch-cpp/tutorials/basics/pytorch_basics/model/\n", |
326 | 349 | "!python create_resnet18_scriptmodule.py" |
327 | 350 | ], |
328 | 351 | "execution_count": null, |
|
473 | 496 | }, |
474 | 497 | { |
475 | 498 | "cell_type": "markdown", |
476 | | - "metadata": { |
477 | | - "id": "2gjZC6b_2PEz" |
478 | | - }, |
479 | 499 | "source": [ |
480 | 500 | "###Convolutional Neural Network" |
481 | | - ] |
| 501 | + ], |
| 502 | + "metadata": { |
| 503 | + "id": "amr2BK2XpJ5j" |
| 504 | + } |
482 | 505 | }, |
483 | 506 | { |
484 | 507 | "cell_type": "code", |
|
0 commit comments