Import architectures such as ResNext50 into Google Colab

I’m a fan of Google Colab, because - once you find out about some little tricks - it is good to run whatever you need to run there.

Since I couldn’t find an answer of how to import different model architectures such as ResNext50 into Colab, I wanted to share this with you here so that you can go grab a coffee instead of spending the morning figuring out, where the fastai directory in colab lives.

You first need to maneuver into the fastai folder. You can do this like this:
# import os lib and change directory
import os
!ls -a

Then you can do the usual untar like this:
!tar -xvzf weights.tgz

That’s it - you’re good to go with any architectures Jeremy included in the weights file.

Cheerio :smiley:


thank you this is cool. can you share other tricks :sunglasses:. thanks again

@tomwanger Are you able to run the fastai in Colab with GPU enabled? I am getting the following error:

`RuntimeError: cuda runtime error (2) : out of memory at /pytorch/torch/lib/THC/generic/`

Never mind. Restart the colab runtime seems like can resolve the issue.


@almandsky, glad that you fixed it (and my apologies for the slo-mo reply: I was off the grid for some days).

In my experience, this error happened mostly when I increased batch size more than Colab GPUs could cope with. Was this the case for you too?