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

AtomRef Updates #158

Merged
merged 17 commits into from
Sep 1, 2023
Merged

AtomRef Updates #158

merged 17 commits into from
Sep 1, 2023

Conversation

lbluque
Copy link
Contributor

@lbluque lbluque commented Sep 1, 2023

A few edits to the AtomRef class:

  • added max_z as optional kwarg for cases where offsets have not been fitted yet.
  • Removed all use of numpy
  • Use lstsq instead of explicitly pseudo-inverse
  • Made property_offset a buffer to avoid errors when running on GPU and with lightning modules
  • Save precomputed identity matrix for onehot vectors as buffer.

@lbluque
Copy link
Contributor Author

lbluque commented Sep 1, 2023

The errors have to do with "Bad serialized model". I don't really understand how to fix those.

I also keep getting this error when running pre-commit:

error: TOML parse error at line 69, column 3
   |
69 |   "PERF203", # try-except-in-loop
   |   ^^^^^^^^^
Unknown rule selector: `PERF203`

Any ideas on how to get rid of it?

@shyuep
Copy link
Contributor

shyuep commented Sep 1, 2023

I think it is a version of ruff that is the problem for the PERF. For bad serialized model, I think your fork may have cached an old model. Maybe mgl clear --yes command to remove all models first?

@lbluque
Copy link
Contributor Author

lbluque commented Sep 1, 2023

Thanks @shyuep !

The "bad serialized" error was actually from my changes. I had to do a few things to fix it:

  • use strict=False when using load_state_dict in IOMixin.load.
  • check if property_offset is a list or ndarray in AtomRef constructor for backcompat with pretrained models.

I also added a raise from the BaseException leading to the "Bad serialized" error because otherwise it can be unclear what the error actually is.

Pls have a look and lmk your thoughts

@codecov
Copy link

codecov bot commented Sep 1, 2023

Codecov Report

Patch coverage: 94.73% and no project coverage change.

Comparison is base (e825b75) 98.06% compared to head (dbd8fdf) 98.06%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #158   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files          28       28           
  Lines        1807     1810    +3     
=======================================
+ Hits         1772     1775    +3     
  Misses         35       35           
Files Changed Coverage Δ
matgl/layers/_atom_ref.py 97.61% <94.11%> (-2.39%) ⬇️
matgl/utils/io.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shyuep
Copy link
Contributor

shyuep commented Sep 1, 2023

Thanks. I think this is fine. I will merge.

@shyuep shyuep merged commit 38ed5f7 into materialsvirtuallab:main Sep 1, 2023
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.

2 participants