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
ModelOnCPU() has destructive side effects? #2541
Comments
Since you have the model available, it's going to be easier for you test than me.
Could you just try this (instead of |
Just an update: I managed to reproduce this bug on a smaller scale and am trying to get some minimal reproducer to find its cause. Not sure yet if it's inside fastai or PyTorch. It's a very subtle one, so it might take me a while to get to the root of it. |
Got it, thanks for the update – let me know if I can help. |
Ok, finally went to the bottom of this. It was due to |
Awesome, verified that it's working correctly on fastai master. Thank you Sylvain! |
Describe the bug
I'm training a
language_model_learner
to generate company names.Surprisingly, I noticed that calling
learn.export()
mutateslearn
in some way that significantly drops the quality of the model.I manually called each line of
learn.export()
to identify where this was going wrong, and found that the model quality drops when entering thewith ModelOnCPU(learn.model) as m:
context.You can see what happens here:
(FYI, loading the exported model with
load_learner
also gives the same garbage predictions.)Provide your installation details
To Reproduce
Perhaps you can reproduce with a smaller example? (It takes a few hours to train the model.)
If not, here is my code:
Expected behavior
learn.export()
should not alterlearn
at all.Screenshots
See above.
Additional context
Also, a similar drop in performance happens if I do
learn.save()
andlearn2.load()
.learn2
will generate the same garbage predictions.learn
is unmodified.The text was updated successfully, but these errors were encountered: