`learn` cannot be copied using deepcopy


I found out that learn cannot be copied using deepcopy anymore if batch_tfms=aug_transforms() is passed into the dataloaders. If dataloaders is created without batch_tfms=aug_transforms(), learn can be copied using deepcopy.

I found out about this error while I was following Live coding 12.

This is the error:

RuntimeError: The default implementation of __deepcopy__() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override __deepcopy__() if it is intended behavior for new_empty() to return an instance of a different type.

Here is a Colab link to reproduce the error.


1 Like

Just bumping this. As of today, this error still appears.
Also raising an issue in github.

1 Like

This should be resolved in the next release of fastai.