Learn.export() failing "PicklingError: Can't pickle <function <lambda> at 0x7f60e83e6bf8>: attribute lookup <lambda> on __main__ failed"

Hi everyone, I’m doing some experiments with FastAI’s unet_learner in this Google Colab notebook.

I want to save my work but learn.export() is failing with the error PicklingError: Can't pickle <function <lambda> at 0x7f60e83e6bf8>: attribute lookup <lambda> on __main__ failed

Any ideas? :thinking:

As said many times on the forums, you can’t pickle lambda functions

A quick search with your exact thread title brought this up:

Heh, my bad. Thanks, I missed that!

1 Like

I used pickle_protocol=dill and that worked. This is an issue where arbitrary named functions can’t be defined (or imported) to your execution context.

2 Likes