'wrapper_descriptor' object has no attribute '__code__'

Getting this with fastai version: 1.0.59

I have no idea how to fix but I’m getting this error when I load_learner(PATH):

'wrapper_descriptor' object has no attribute '__code__'

I am using custom DataBlockAPI code (itemlists, processors, itembases) so not sure if I’m missing something there or what. Any ideas?


Make sure you have @dataclass annotation above any custom callback classes.


same issue. can u please explain what to be done?

do you have a gist I can look at? This was for v.1 way back in the day … not sure if I can help, but I can try.

Thanks sir.
When i try to load my trained model in another notebook using load_learner(), i get the following error:
AttributeError: ‘wrapper_descriptor’ object has no attribute ‘code

i saved my model using learn.export(). ( AND yes it has custom weights if thats related to it)
I am using Fastai 1.0.61 pytorch 1.10

I wish I could help but I haven’t used the v.1 bits in forever. I’d try updating everything to the latest v.2 package and see if you can get things working.

1 Like