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

There’s a lot of good tips and resources here - can folks please help by summarizing/copying them into the top wiki post, so the key info is all in one place? Try to organize it as clearly as you can! :slight_smile:

Do you may know how to access directly to the fastai documentation and source code from Colab?
If I use ?? Function It opens the “help” window on the right but I don’t see how to be redirect on the fastai documentation website.

It won’t redirect you. My best recommendation is to follow the following nomenclature/ideas:

Look at the file being used at the bottom. In our case it’s data/external. To get it from the documentation, it’s dev.fast.ai/first.second.html

So how would that look like?

dev.fast.ai/data.external.html

And then to jump to a particular function, add in #func_name at the end. IE:

dev.fast.ai/data.external.html#untar_data

Also unsure why it doesn’t want to hyperlink here

3 Likes

First time posting in the forums, hope I’m doing this right :slight_smile:

@wittmannf thank you so much fo the guide for running lesson 1 in Colab, that made it a lot less confusing for me

It was working for me up until this part, reached an error in the screenshot below:

Would love some help figuring out what is going on with this error. Thank you

Hey Rebeca! Welcome to the forums!! :slight_smile:

Regarding the error, please double check if you are running the following code cell:
Screen Shot 2020-03-18 at 22.33.20

That’s the cell where learn is going to be defined (learn = ...). Let me know if that works and feel free to ask any other question!

2 Likes

It worked!!! Thank you! I’m so excited!

3 Likes

COLAB TRICK - Instead of manually writing again and again the same code at the very top use custom snippets and it will take you 0.1 seconds! You can use my code here and this short tutorial.

5 Likes

Folks, I’ve managed to get a running VS Code Environment in Google Colab. You can access the python files and IPython Notebooks (still no support for ipywidgets though) on the underlying hardware of Google Colab.

With the Google Drive mounted on, the has the potential to be a fully development environment. I have documented the steps and details here. Feel free to try and comments are welcome.

Also, if you just want the notebook, you can get it here.

3 Likes

Can you add this to the wiki top post, with a bit more info about what it does and why?

2 Likes

really cool trick @mgloria! Also, I liked the dark style :slight_smile: I will be changing mine as well

1 Like

Did anyone get the buttons from 02_production.ipynb to work on Colab? Here’s what I have so far: https://github.com/WittmannF/course-v4/blob/master/nbs/02_production_colab.ipynb

1 Like

Not sure if it is a bug or I am doing something wrong, but when running 01_intro.ipynb on colab, the following cell is currently raising an error:

Source: https://github.com/WittmannF/course-v4/blob/master/nbs/01_intro_colab_dev.ipynb

My previous version (from last week) was running smoothly and I didn’t change anything in that part:

Source: https://github.com/WittmannF/course-v4/blob/master/nbs/01_intro_colab.ipynb

UPDATE

Was able to run that cell by removing the input argument path:

from fastai2.tabular.all import *
path = untar_data(URLs.ADULT_SAMPLE)

dls = TabularDataLoaders.from_csv(path/'adult.csv', y_names="salary",
    cat_names = ['workclass', 'education', 'marital-status', 'occupation',
                 'relationship', 'race'],
    cont_names = ['age', 'fnlwgt', 'education-num'],
    procs = [Categorify, FillMissing, Normalize])

learn = tabular_learner(dls, metrics=accuracy)

Probably it is a last minute update in TabularDataLoaders

1 Like

Not presently. The only shareable workaround I’m aware of is using the google colab file uploader (code shared below) rather than the fast.ai library uploader. The code behind the notebook widgets seem quite sophisticated.
from google.colab import files
uploaded = files.upload()

2 Likes

You can do the same with ipywidgets enabled JupyterLab as shown here.

You can also thry the instant colab notebook version.

1 Like

After some deliberation we’ve determined this doesn’t break the Terms of Service, so the directions are in the Wiki again

FYI folks, @deeplearner and @imrandude both came up with a methodology of turning your colab instances into full Jupyter Environments. This is experimental and Colab may patch this at any moment. Please use at your own discretion. The directions are in the top post (and we simplified it a bit). If there are any install issues etc ping me and I’ll work on it.

This means you can use any Jupyter widgets in it!

3 Likes

This sounds great! I tried the code snippets in the wiki, yet no tunnels appear in my ngrok account - even after ~5+ minutes. Do I have to wait longer?

Looking into it now, I noticed this bug too. It was working as of last night so let me investigate

Please try this if you have any trouble.

1 Like

For now here are the steps to run it in one go while I fix the script:

!git clone 'https://github.com/fastai/course-v4.git'
!echo Setting up server...
!curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
!sudo apt-get install -q -y nodejs
!pip install -q jupyter jupyterlab --upgrade
!pip install -q jupyter_contrib_nbextensions && jupyter contrib nbextension install
!pip install -q -r /content/course-v4/requirements.txt
!wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip -qq -n ngrok-stable-linux-amd64.zip
get_ipython().system_raw(f'./ngrok authtoken {authtoken} && ./ngrok http --log=stdout 8888 > ngrok.log &')
!perl -pi -e 's|execution_count": null|execution_count": 1|g' course-v4/nbs/*ipynb
!nohup jupyter notebook --no-browser --allow-root --ip=0.0.0.0&
2 Likes

And then to kill the server:
!kill $(ps aux | grep './ngrok' | awk '{print $2}')