Run fastai locally - PicklingErrorr: Can't pickle function crop_pad at ... it's not the same object as

Hi everyone! :slight_smile:

I am trying to run lesson 1 locally. Everything works fine until I try to fit the model.

I am getting the same error for both .fit() and .fit_one_cycle() methods:

PicklingError: Can't pickle <function crop_pad at 0x000001EE6001C598> it's not the same object as

I am using:

  • fastai.__version__: 1.0.34
  • torch.__version__: 1.0.0

on Win10 64bit.

I also run into the same error when tryin’ to execute .show_batch() method.

Do you have any ideas how to address this problem?

Will be super grateful for your help! :slight_smile:

Thanks and have a great day there,


I had this exact problem too and didn’t find any suggested solution, and I am using Win10 64bit as well.
I hope someone can address it.

I found that my problem was updating Pytorch, using Pytorch 1.0.0 solves the problem : “conda install -c pytorch pytorch=1.0.0”
You can refere to this article if you still didn’t solve the problem maybe you’ll find the solution there :

1 Like

i also face the same issue, util now,i can’t solve it. if you solve this problem ,please tell me ,thank you

I have the same problem, please help

Did you try “conda install -c pytorch pytorch=1.0.0” ? you can check the article I referred to above it might help you if the update did not work.

Sorry for the late response.

I’ve had a similar error using and Learner.load in a later session. Despite having the same underlying network, it can’t unpickle and load it. edit Turns out I can use Learner.load so long as I set purge=False

I tried this - I had the same error of the subject - with Windows 10, Anaconda, Fastai 1.0.34 and torch 1.1.0. When running the above fastai was broken. Now

from import *

throws the error

ImportError: DLL load failed: The specified procedure could not be found.

I had to install everything from scratch :frowning: following this post but with a small change because I have no GPU in the PC:

conda install -c pytorch=1.0.0 pytorch-cpu torchvision

now I have 1.0.57 and pytorch 1.0.0 on my W10 PC without GPU. I know I cannot train the networks, but I run / test the data preparation locally before moving on Paperspace to execute training.


I tried all the suggestions here, I’m still getting the same error. If you have any idea on how to solve this, please let me know. Thanks in advance.