Skip to content

Instantly share code, notes, and snippets.

@motiur
Last active June 20, 2018 09:04
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save motiur/2e0cd3d35bc1c42b6e5d6046b65be6f4 to your computer and use it in GitHub Desktop.
Save motiur/2e0cd3d35bc1c42b6e5d6046b65be6f4 to your computer and use it in GitHub Desktop.
Keras and Pytorch in Google Cloud VM
# This script is designed to work with ubuntu 16.04 LTS
# with keras 1.2.2 and the latest Pytorch with CUDA 8 support
##########################################################################
#This is used to install CUDA 8 driver for Tesla K80
##########################################################################
#!/bin/bash
echo "Checking for CUDA and installing."
# Check for CUDA and try to install.
if ! dpkg-query -W cuda-8-0; then
# The 16.04 installer works with 16.10.
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
apt-get update
apt-get install cuda-8-0 -y
fi
#########################################################################
#############################################################################
#Updating the system
#############################################################################
sudo apt-get update
sudo apt-get --assume-yes upgrade
sudo apt-get --assume-yes install tmux build-essential gcc g++ make binutils
sudo apt-get --assume-yes install software-properties-common
#########################################################################################################################
#Installing anaconda with the required packages
#########################################################################################################################
wget "https://repo.continuum.io/archive/Anaconda3-4.3.0-Linux-x86_64.sh" -O "Anaconda3-4.3.0-Linux-x86_64.sh"
bash Anaconda3-4.3.0-Linux-x86_64.sh -b
echo "export PATH=\"$HOME/anaconda3/bin:\$PATH\"" >> ~/.bashrc
export PATH="$HOME/anaconda3/bin:$PATH"
conda install -y bcolz
conda upgrade -y --all
#########################################################################################################################
#Installing keras with tensorflow , as well kaggle client
#########################################################################################################################
pip install keras==1.2.2
pip install tensorflow
pip install kaggle-cli
#You can confgure your kaggle account details here
#kg config -u 'username' -p 'password' -c 'dogs-vs-cats-redux-kernels-edition'
#kg download
#########################################################################################################################
#Installing Jupyter notebook
#########################################################################################################################
# configure jupyter and prompt for password
jupyter notebook --generate-config
jupass=`python -c "from notebook.auth import passwd; print(passwd())"`
echo "c.NotebookApp.password = u'"$jupass"'" >> $HOME/.jupyter/jupyter_notebook_config.py
echo "c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False" >> $HOME/.jupyter/jupyter_notebook_config.py
echo "\"jupyter notebook\" will start Jupyter on port 8888"
echo "If you get an error instead, try restarting your session so your $PATH is updated"
#########################################################################################################################
#Downloading the old courses Fast AI 1 and 2 - and as well as new Fast AI 1
#########################################################################################################################
cd ~
git clone https://github.com/fastai/courses.git
git clone https://github.com/fastai/fastai.git
#########################################################################################################################
#Installing google compute engine package, unzip package, and gensim package( it is useful for Fast AI Part 2 - 2017)
#########################################################################################################################
sudo apt-get install unzip
pip install --upgrade gensim
pip install google-compute-engine
#########################################################################################################################
#Installing all the relevant packages for doing lesson 1 of Fast AI Part 1 - 2017
#########################################################################################################################
conda install pytorch torchvision cuda80 -c soumith
pip install torchtext
conda install opencv
pip install isoweek
pip install pandas_summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment