Problem with running fast.ai chapter 8

Hi everyone. Since last three days, I am trying to run chapter 8 in Google colab. However, this line “from fastai.conv_learner import *” always seems to throw a new error. Now, it is showing “cannot import name ‘BatchSampler’” error. Yesterday, it was throwing an error saying some brackets and ‘’ were missing. I am using following commands to import fast.ai library and the dataset.

!pip install https://github.com/fastai/fastai/archive/master.zip
!pip install opencv-python
!apt update && apt install -y libsm6 libxext6
!pip3 install http://download.pytorch.org/whl/cu80/torch-0.3.0.post4-cp36-cp36m-linux_x86_64.whl
!pip3 install torchvision
!mkdir data
!wget http://pjreddie.com/media/files/VOCtrainval_06-Nov-2007.tar -P data/
!wget https://storage.googleapis.com/coco-dataset/external/PASCAL_VOC.zip -P data/
!tar -xf data/VOCtrainval_06-Nov-2007.tar -C data/
!unzip data/PASCAL_VOC.zip -d data/
!rm -rf data/PASCAL_VOC.zip data/VOCtrainval_06-Nov-2007.tar

I suspect you face this problem because you are using the older version 0.7 notebooks but you are installing fastai library version 1.0.

!pip install https://github.com/fastai/fastai/archive/master.zip

The line above will download and install fastai lib latest version (1.0 and above). If that’s not your intention, please install fastai lib version 0.7 (the version before 1.0).


Updates:

  • See this thread. The solution is in there.