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

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}')

Script works now, apologies! See the updated one in the top post

1 Like

Can I know, why you are doing this?

I included it in the script as there are few issues with running notebooks due to an error caused by execution count. The line basically takes care of that. If you are not facing any issues with running the notebooks, you can remove that line

1 Like

Great, thank you! Can you tell me what the bug was? I couldn‘t find it…

An issue with running the bash scripts basically. I was trying to do it via curl but I had to save the script via wget then run it with sh bash.sh

I just wanted to say that i love this little hack. Having access to a cheap/free gpu and using the default jupyter gui makes me so much more productive, including achieving this with a single function call.

Thanks for your efforts!

2 Likes

I concur to this.

1 Like

Hi all. So after the dust has settled: there now a standard, working, best-practice notebook for setup in Colab, and if so, where can I find it?

@jcatanza see the top post. There’s a few methods you can work with and all do.

1 Like