Cannot import name 'Callback' after 1.0.59

After I upgraded fastai to 1.0.59 I got this error when doing from fastai.callbacks import Callback

It looks like fastai.callbacks.Callback was renamed to fastai.basic_train.LearnerCallback. Is this right?

No, but you are importing it from the wrong module. Callback leaves in fastai.callback.

1 Like

Thank you for your reply. I made my custom callback inherit fastai.basic_train.LearnerCallback and it worked. What’s the difference between fastai.callback.Callback and fastai.basic_train.LearnerCallback?

A LearnerCallback will have the Learner has an attribute (if you need it), a regular Callback does not.