Last active
May 31, 2022 05:57
-
-
Save Con-Mi/f7b7c7758a46da49f84bc68b47997d69 to your computer and use it in GitHub Desktop.
A shell file to install CUDA 9.2 backend for PyTorch 0.4.1 on Google Colab.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TEXT_RESET='\e[0m' | |
TEXT_YELLOW='\e[1;33m' | |
wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64 | |
echo -e $TEXT_YELLOW | |
echo 'WEBGET finished..' | |
echo -e $TEXT_RESET | |
dpkg --install cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64 | |
echo -e $TEXT_YELLOW | |
echo 'DPKG finished..' | |
echo -e $TEXT_RESET | |
apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub | |
echo -e $TEXT_YELLOW | |
echo 'APT added key..' | |
echo -e $TEXT_RESET | |
apt-get update | |
echo -e $TEXT_YELLOW | |
echo 'APT update finished..' | |
echo -e $TEXT_RESET | |
apt-get install cuda | |
echo -e $TEXT_YELLOW | |
echo 'APT finished installing cuda..' | |
echo 'The CUDA version is: ' | |
cat /usr/local/cuda/version.txt | |
echo -e $TEXT_RESET | |
pip install http://download.pytorch.org/whl/cu92/torch-0.4.1-cp36-cp36m-linux_x86_64.whl | |
echo -e $TEXT_YELLOW | |
echo 'pip fininshed installing PyTorch 0.4.1 with CUDA 9.2 backend..' | |
echo -e $TEXT_RESET | |
pip install torchvision | |
echo -e $TEXT_YELLOW | |
echo 'pip finished installing torchvision..' | |
echo -e $TEXT_RESET |
I wrote this bash script a while ago when PyTorch was not yet into version 1.0 and since nvidia Cuda 9.2. I think now they have made easier installations for this, but it can still work for google colab for example. You can fork it and modified it as you want.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pip install torchvision
leads to PyTorch 0.4.1 being uninstalled and PyTorch 1.5.1 getting reinstalled! It should betorchvision==0.2.1
.