Platform: Colab ✅

!curl -s https://course.fast.ai/setup/colab | bash , this line does not work

In addition, how do I change the base path so I don’t need to download the data from fastai to the root/.fast folder that is hidden for colab?

Hi @JonathanSum were you able to fix this? I am facing the same.

Many thanks for advise,
Tom

If you’re trying to set up the old course, could try course19 rather than course

1 Like

Hi. You can fix it by setting the download location and setting the path variable:
Your problem is dataset were downloaded to the hidden folder of Colab, so Colab won’t allow you to see them in the file panel.
Here is my fastbook18 for solving this issue.
Below is what I did to fastbook 18.


mkdir happy-sugar-life
path = untar_data(URLs.IMAGENETTE_160, dest= "/content/happy-sugar-life")

You can see my fastbook’s notebook 11, 15, 18, and 19 were all set in this way to avoid this problem, and I have ran all these 4 notebooks and they all work perfectly.

Again, here is my Colab that solved this issue. https://github.com/JonathanSum/Fastbook_colab

Maybe I should ask @jeremy or @muellerzr that should we make a pull request to change it to create a folder and download them into that folder, rather than downloading to a hidden Colab folder that we can not see?

Unfortunately,
!curl -s https://course19.fast.ai/setup/colab | bash
doesnt look like correct solution.

It installs fastaiv1(1.0.61) and fastaiv2(0.30) and the latter one causes that i.e. ImageDataBunch class does not exist.
What helped me to take the script from “https://course19.fast.ai/setup/colab”, modify it to force only installation of fastaiv1 and after that also to force pandas downgrade to be compatible with colab.

!mkdir -p /root/.torch/models
!mkdir -p /root/.fastai/data
!ln -s /root/.torch/models /content
!ln -s /root/.fastai/data /content
!rm -rf /content/sample_data/
!pip3 install fastai==1.0.61 --force
!pip install pandas==1.0.0

After runtime restart, notebooks run again :slight_smile:

1 Like

My previous code doesnt work, if you want to load old pth model file in fastai v1 on Colab with torch 1.6
I got stuck with error
ModuleAttributeError: ‘BatchNorm2d’ object has no attribute ‘_non_persistent_buffers_set’

And following “dependancy hell” forced me to use conda on Colab, the scripts below seem to solve it, now loading pth without issues:

! wget https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.2-Linux-x86_64.sh
! chmod +x Miniconda3-py37_4.8.2-Linux-x86_64.sh
! bash ./Miniconda3-py37_4.8.2-Linux-x86_64.sh -b -f -p /usr/local
import sys
sys.path.append(’/usr/local/lib/python3.7/site-packages/’)

!mkdir -p /root/.torch/models
!mkdir -p /root/.fastai/data
!ln -s /root/.torch/models /content
!ln -s /root/.fastai/data /content
!rm -rf /content/sample_data/
! conda install -c fastai fastai==1.0.61 --force -y

1 Like

I’m noticing that the text and latest version of the code on github is not reflected in this link:

How do I run the code at fastbook/05_pet_breeds.ipynb at master · fastai/fastbook · GitHub on colab?