Platform: Colab

Any questions related to Google Colaboratry (colab) can be posted here.

2 Likes

Just kicking off this topic for those who are interested.

You can get started by going to https://colab.research.google.com and fetching notebooks from this github repo https://github.com/Skraper/fastai_colab.

3 Likes

Just hold off on this for a moment. We’ll be launching Colab support soon. :slight_smile:

1 Like

If you want to experiment in the meantime, pics (no prose) of the steps are here:

http://course-v3.fast.ai/start_colab

http://course-v3.fast.ai/update_colab

9 Likes

I was able to run in Colab except that it failed due to memory on the fit_one_cycle
RuntimeError: DataLoader worker (pid 984) is killed by signal: Bus error.

I reduced the batch size and it was able to complete the first epoch, and then it died again.

You need to resize the shm partition, it is usually only around 30mb.

2 Likes

@jeremy sorry for preempting, I just wanted to share how I solved the problem of getting fatai working on colab.

1 Like

No apology needed! Your contribution is much appreciated :slight_smile:

Oh I just noticed you’ve dealt with this in your notebook - that’s wonderful. I’ll add it to our script now.

@gamo My colab /etc/fstab is empty (except for one comment), so sed doesn’t work. Instead I just created a new one with the shm you show.

Do you know why we might have different fstab’s? I’d like to create something that works reliably.

1 Like

@jeremy The fstab is empty, except for the comment, to begin with. The sed command will append the tmpfs entry if there is none and update it if there is one.

This is what I get when I run that section with some output added.

2 Likes

Fantastic @gamo . Script updated. You can now set up your colab notebook with just one cell:

 !curl http://course-v3.fast.ai/setup/colab | bash
11 Likes

Looks good.
Makes it a lot easier to get set up.

1 Like

I followed the instructions in the link http://course-v3.fast.ai/start_colab and everything went fine. Then, from the colab welcome page, I opened 00_notebook_tutorial.ipynb and started working through it. I encountered a couple of problems:

In the opening block of text is the following instruction:
"On the page you used to open this, tick the box next to the name of the notebook and click duplicate to easily create a new version of this notebook."

Problem 1: there is no box to tick, and no ‘duplicate’ selection.

I saved a copy to google drive by clicking on the link at the right of the filename (is that what the instruction was trying to tell us to do?), opened the copy and continued to follow the notebook

In Section 1: Need to Know under the subsection labeled Writing, there is the following instruction "Click on the the ‘+’ button on the left and select Markdown from the toolbar."

Problem 2: There is no + button on the left and there is no toolbar from which to select "Markdown"

In fact, the notebook lacks the orange jupyter graphic at the left of its toolbar menu ,as pictured in the diagram accompanying (below) the instruction. Instead, a colab graphic (looks sort of like an infinity symbol) appears at the left of the toolbar menu; and though the toolbar has ‘+’ buttons to create text and code cells, there is no button to create a markdown cell. As far as I can tell, there is no way to create a markdown cell, or to change an existing cell to markdown, as in the normal jupyter interface.

Has anyone else encountered these problems, or have I missed something?

The colab interface is a bit different from the regular jupyter notebook interface.

The class notebooks are written for regular jupyter notebooks so the instructions may not match exactly what you need to do in colab.

Problem 1:
Saving to google drive just as you did is the way to go.
Markdown cells in colab are called “text” cells.

Problem 2:
Colab does not (to my knowledge) allow you to change cell types.

You can use the menus, icons and key shortcuts to add/delete/edit cells. You can also add cells by hovering between cells and use the popups.

Use Ctrl+M H to view the key shortcuts to increase your productivity.

1 Like

Thanks Gabriel, that’s very helpful. I didn’t know that “text” cells are the same as “markdown”.

Problem 2 isn’t true.IIRC, the keyboard shortcut for switching to markdown is Cmd+M+M (or Ctrl M M for Win)
and for switching to code is Cmd/Ctrl Y Y .

1 Like

hello

when i run:

!curl http://course-v3.fast.ai/setup/colab_update | bash

i get this:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13258 100 13258 0 0 231k 0 --:–:-- --:–:-- --:–:-- 235k
bash: line 1: syntax error near unexpected token newline' bash: line 1:

thanks

It would seem as the script at http://course-v3.fast.ai/setup/colab has been updated. It now checks to see if you already run it and fastai is already installed, if so it will update installs and repos.

The colab_update script does not seem to be available any longer.

@jeremy is this true?

1 Like

You are right, my bad for not reading the whole shortcut list.

There does not seem to be a way to do this through the gui though.

1 Like