Skip to content

Instantly share code, notes, and snippets.

@JohnGiorgi
Last active November 24, 2018 15:21
Show Gist options
  • Save JohnGiorgi/3216b4aa672c3743fd667f65039c8fb0 to your computer and use it in GitHub Desktop.
Save JohnGiorgi/3216b4aa672c3743fd667f65039c8fb0 to your computer and use it in GitHub Desktop.

Setting up an Enviornment for Fastai

TOC

Useful links

Google Colab Setup

This is by far the easiest route. For each lesson, just open the notebook at select File > Save copy in Drive ...

Note, you may have to use Google Chrome. Google Colab did not work in Safari for me.

Then run the "setup" cells that I have added to the beginning of each notebook. Thats it! To use a GPU, go to Edit > Notebook settings > Hardware accelerator > GPU.

Local Setup

Installing python / conda

Arguably the easist way to manage your python / deep learning stack is to use conda, specifically, miniconda. Installation instructions can be found here, but essentially:

# download the installer
curl https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh --output ~/miniconda.sh

# run it
bash ~/miniconda.sh

Setting up a fastai enviornment

Follow the instructions here to setup an enviornment for following along with the fastai course (either GPU or CPU). Essentially:

# make sure conda and pip are up-to-date
conda update conda

# create a virtual enviornment with everything we need for running the lessons 
git clone https://github.com/fastai/fastai.git
cd fastai
conda env create -f environment.yml

# activate that enviornment
conda activate fastai

There are some additional steps not present in the instructions above. You need to install nb_conda, which allows you to use your virtual environment from within a notebook:

conda install nb_conda

and you need to downgrade one of the pytorch packages (this is likely temporary!)

pip install torchtext==0.2.3

Using the notebook

To use the notebook, you have to activate your enviornment:

source activate fastai

move into the fastai repo

cd path/to/fastai

and launch jupyter notebook

jupyter notebook

Make sure that you select the right kernel! (Kernel > Change kernel > Python [conda:fastai])

Accessing your jupyter notebook remotely

Following the instructions here for a secure setup.

For a less secure setup,

  1. On the host machine:
source activate fastai
cd path/to/fastai
jupyter notebook
  1. On the local machine:
8888:localhost:8888 <username>@<host>

the notebook should be accesible in your browser at localhost:8888.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment