Skip to content
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

Make Models Pickleable Again #133

Merged
merged 3 commits into from
Dec 25, 2020
Merged

Conversation

alexander-g
Copy link
Contributor

Bugfix for cloudpickling models which also affected Model.save.
Jitted functions cannot be pickled and need to be excluded before pickling.

@cgarciae
Copy link
Collaborator

cgarciae commented Dec 22, 2020

Hey @alexander-g ! I am starting to feel that Model.jit, Model.init_jit and friends should be properties that access a e.g. Model._jit and construct it if its None. We could also add a clear_jit method to clear all jitted functions all at once for stuff like serialization, each should just reconstruct themselves upon access.

I am curious as to why this didn't happened before?

@alexander-g
Copy link
Contributor Author

I've just checked, it's because of the Jax version. Jitted functions were pickleable up until 0.2.5. Stopped working from 0.2.6 on

@codecov-io
Copy link

codecov-io commented Dec 23, 2020

Codecov Report

Merging #133 (2f356a6) into master (14fba6c) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #133      +/-   ##
==========================================
+ Coverage   79.22%   79.34%   +0.11%     
==========================================
  Files         110      110              
  Lines        5190     5210      +20     
==========================================
+ Hits         4112     4134      +22     
+ Misses       1078     1076       -2     
Impacted Files Coverage Δ
elegy/model/model_base.py 76.42% <100.00%> (+0.51%) ⬆️
elegy/model/model_test.py 100.00% <100.00%> (ø)
elegy/module.py 89.39% <100.00%> (+0.46%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14fba6c...2f356a6. Read the comment docs.

@cgarciae
Copy link
Collaborator

I reviewed the changes a little further and they are good!

@cgarciae cgarciae merged commit 68efe27 into poets-ai:master Dec 25, 2020
@alexander-g alexander-g deleted the modelpickle branch December 25, 2020 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants