The PL 1.0.x update has removed the trainer argument from TrainerCallbackHookMixin when calling e.g. callback.on_init_start(self). However, Callback has not been updated for this change. This results in a missing argument trainer.
TrainerCallbackHookMixin link: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/trainer/callback_hook.py#L42Callback link: https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pytorch_lightning/callbacks/base.py#L38
BoringModel colab: https://colab.research.google.com/drive/1i38oUFbnkgmgamMk6Jc4zpc9BrF31ZfE?usp=sharing
BoringModel
Not throw an error when using class MyPrintingCallback(Callback)
TypeError Traceback (most recent call last)
<ipython-input-13-1f9f6fbe4f6c> in <module>()
----> 1 test_x(tmpdir)
3 frames
/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/callback_hook.py in on_init_start(self)
40 """Called when the trainer initialization begins, model has not yet been set."""
41 for callback in self.callbacks:
---> 42 callback.on_init_start(self)
43
44 def on_init_end(self):
TypeError: on_init_start() missing 1 required positional argument: 'trainer'
possible duplicate of #3813? Not sure if rooted entirely in same issue
Sorry, it seems I didn't save the modifications to show the bug. I was not allowed to save, because I didn't copy the notebook. The link in the original post has been updated.
@NumesSanguis you need to call your custom callback class
callbacks=[MyPrintingCallback()] # needs ()
@ydcjeff is right, his fix does the trick
Yup, can confirm that this was the issue.