New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some fastai Loss Functions Cannot be Exported due to Pickling Error #3901
Comments
Hey @warner-benjamin, let me know if this still needs picking up, I'll put in a PR if so. |
@nglillywhite I am unaware of this being worked on |
Great, I'll have a look and put in a PR, thanks |
PR 3910 adds these guards for current loss functions, I'd like to investigate why these loss functions can't be pickled with this issue but happy to open a new issue & PRs if you'd like to keep them separate. |
Hi, I am facing a same issue on Focal Loss, unable to pickle focal loss. am I missing out something, is there any solution to this problem. |
Bump. Same issue here. Would like to export a Learner with FocalLossFlat |
Some fastai loss functions, such as
LabelSmoothingCrossEntropyFlat
are not picklable, and thus not exportable viaLearner.export
. But most, includingLabelSmoothingCrossEntropy
and other flattened losses, appear pickle without issue.This minimal reproduction on Python 3.10 with the
Learner.export
defaultprotocol=2
results in
TypeError: cannot pickle 'code' object
forLabelSmoothingCrossEntropyFlat
but no errors forLabelSmoothingCrossEntropy
orCrossEntropyLossFlat
.We should probably add a test for pickling
LabelSmoothingCrossEntropyFlat
to catch future changes to pickle.The text was updated successfully, but these errors were encountered: