Problem with OptimWrapper

I am trying out different optimization methods in Kaggle notebook. I attempt to use Pytorch’s AdaGrad with OptimWrapper but get an error as followed:

The get_learner function is defined in the chapter 16 of the fastai book:

def get_learner(**kwargs):
      return cnn_learner(dls, resnet34, pretrained=False,
                                    metrics=accuracy, **kwargs).to_fp16()

Did I do something wrong? Please help me, Thanks!

1 Like

What version of fastai are you using? Obtain with this:

import fastai; print(fast.__version__)

It’s version 2.2.7

The OptimWrapper functionality was changed in 2.3.0, and versions before that work differently. I would recommend upgrading your fastai version.

Thanks! I don’t get the error anymore after upgrading to 2.3.0.

1 Like