Fastai 0.7.0 not working in Google Colaboratory anymore?

I am using Google Colaboratory and fastai 0.7.0

It worked fine some time back (I would guess in January this year),
now I am having a look at the notebooks, and they fail to run (without any code changes)

I have been using the dogs vs cats example from the course.

!pip install -q torchtext==0.2.3
!pip install -q fastai==0.7.0

torch.__version__

gives 0.3.1

arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

module 'torch.nn.init' has no attribute 'kaiming_normal_'

No idea why it worked some months back and what changed.

I try to figure out what the issue is, and it seems to be due a need to upgrade to pytorch:

I kill the Colab seesions, and reset,

and then try to upgrade
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.1-{platform}-linux_x86_64.whl torchvision

torch.__version__
gives 0.4.1

Running the code again
arch=resnet34
data = ImageClassifierData.from_paths(PATH, tfms=tfms_from_model(arch, sz))
learn = ConvLearner.pretrained(arch, data, precompute=True)
learn.fit(0.01, 2)

/usr/local/lib/python3.6/dist-packages/torch/cuda/__init__.py:114: UserWarning: 
    Found GPU0 Tesla T4 which requires CUDA_VERSION >= 9000 for
     optimal performance and fast startup time, but your PyTorch was compiled
     with CUDA_VERSION 8000. Please install the correct PyTorch binary
     using instructions from http://pytorch.org
    
  warnings.warn(incorrect_binary_warn % (d, name, 9000, CUDA_VERSION))

so I think it is runs on CPU now instead, and it never finishes (it runs out of memory on colab after a while)

If I try to upgrade to pytorch 1.1 I get

ERROR: fastai 0.7.0 has requirement torch<0.4, but you'll have torch 1.1.0 which is incompatible.

is anyone successfully running 0.7.0 in Google Colab?

1 Like

I tried exactly the same things for the “dl2 lesson 1” pascal.ipynb with fastai 0.7. And I am facing exactly the same errors.

Hey guys
I’ve tried same and i got error when i was trying to run convnet learner.
i try to fix it, if i could i put the code here

Any updates on this ?