Platform: Colab (Free; $10/month Pro)

To use Colab for the course, follow the direction here:

For advanced users:

EXPERIMENTAL:

@imrandude and @deeplearner have made a script for using the Colab environment as a full Jupyter instance. To do so, please follow these steps:

Big Warning: This is experimental, not outspokenly recommended, and could be patched at a later date by Google, please use at your own discretion

  1. Create an account and generate an authorization code here
  2. Add the two following cells into your Colab notebook of choice:
import subprocess
def setup_colab(tok):
  subprocess.call(['wget', 'http://tiny.cc/pqjwlz', '-O', 'bash.sh'])
  subprocess.call(['sh', 'bash.sh'])
  get_ipython().system_raw(f'./ngrok authtoken {tok} && ./ngrok http --log=stdout 8888 > ngrok.log &')
  subprocess.call(['wget', 'http://tiny.cc/qrjwlz', '-O', 'bash2.sh'])
  subprocess.call(['sh', 'bash2.sh'])
def end_session():
  subprocess.call(['wget', 'https://tinyurl.com/wxhs52a', '-O', 'bash3.sh'])
  subprocess.call(['sh', 'bash3.sh'])
  1. To spin up your server, run setup_colab(tok) and pass in your server token.
  2. Navigate to the “Status” page here and your server should show up. If two do, choose the first
    You now have a working Native Jupyter Environemnt (so widgets work etc) off of Colab. (it may take a few minutes before it shows up, its dependent on how long the cell takes to run)

MAKE SURE to end the session when you are done by running end_session() so the server does not run forever!

To use the master branch from GitHub, run the following:

!pip install git+https://github.com/fastai/fastai 
!pip install git+https://github.com/fastai/fastcore
  • Note, if you have already installed and began running fastai code, you will need to restart your runtime

FAQ:

  • It says I can’t get a GPU (no GPU available, why?):
    Colab Pro released and so there is a small chance you may not be able to access a GPU. You should try again a little later to see if one opened up. Pro users do not have to worry about this issue
28 Likes

Advanced users only:

For Bleeding Edge (a.k.a Master Branch) Install :

# Setup the Fastai Dev
!git clone https://github.com/fastai/fastai2  && cd fastai2 && pip install -q -e ".[dev]"
!git clone https://github.com/fastai/fastcore && cd fastcore && pip install -q -e ".[dev]"

P.S: Dont forget to restart the Runtime for the changes to reflect.

1 Like

FYI @gokkulnath there’s a simpler method than that:

!pip install git+https://github.com/fastai/fastai2 
!pip install git+https://github.com/fastai/fastcore
4 Likes

@muellerzr want to add that to the top post FAQ (it’s a wiki)? Make sure to clarify it’s for advanced users.

Done :slight_smile:

is cloning book repo enough? or does one need to cd fastbook and pip install -r requirements.txt as well?

@miwojc I’m not sure the best approach - please try it out and see what you think is best.

1 Like

IMO, the best option could be to simply clone the book into your Google Drive, and then choose “Open from Google Drive” and navigate to the chapters we want to work out of. You can’t open up a cloned book from colab’s environment (like I think we’re hoping we can). As it’s colab you’d need to install each time you open a notebook for fastai2, but that’s a regular now anyways :slight_smile:

i got cofused, sorry. this is for colab. i don’t have that much experience using colab, so i would leave it to @muellerzr :slight_smile: . thank you!

Just tested this now, we cannot. So the ideal scenario is to do as follows:

  1. In a general new notebook, run the following:
from google.colab import drive
drive.mount('/content/drive')

After mounting do

!git clone https://github.com/fastai/fastbook.git 'content/drive/My Drive/'

This should clone everything into your Google Drive. From there:

  1. “File, Open Notebook, Google Drive” to select the notebook you want to use for the lesson.

@jeremy would you like me to make a notebook describing this? :slight_smile:

(obviously we can work directly out of the GitHub too permanently, just unsure which method you think is best)

2 Likes

Best would be to edit the wiki top post, if that’s OK.

Just did the steps myself, this was the best solution I figured out. Sadly unless you open the Colab notebook first it looks like the notebook won’t show up in the “Google Drive” section, but once opened you can save your work :slight_smile:

1 Like

I run things on my own local machine but I’m curious about how folks are liking colab for doing this course and doing day-to-day work?

From your experience.

  1. What are the pros?

  2. What are the cons?

  3. What are the tips/tricks for making colab work and give you that “local development” feel?

I’m a broke college student without my own setup, saves me $$$

I do most of my work in collaboration with professors so our stuff is on Google Drive anyways

Very rare timeouts, otherwise no complaints here :slight_smile: (besides of course you need to be online to do anything)

Work out of google drive. Often. Get used to bash commands so you can still run scripts etc if you’re more comfortable doing that

4 Likes

any specific instructions for from utils import * , it throws an error.

@barnacl did you mean to post this in the WWF2 thread?

Yah I work with HS students and have found it invaluable for that reason and that they could just start working on things (btw, your “walk thru” was really helpful in this regards).

1 Like

Also, think of your Drive as your local directory, and operate in your notebook as though it’s a terminal too (if you prefer terminal based stuff)


got everything to the drive, i do a pip install, open the the first notebook.
currently i’m just uploading the utils.py file @muellerzr

Actually no, I understand now. You should mount your drive in each notebook actually and then %cd to the fastbook repository (I made this without fully running it so I missed a few things, sorry!)

1 Like