materialsvirtuallab / matgl

Graph deep learning library for materials
BSD 3-Clause "New" or "Revised" License
232 stars 57 forks source link

[Bug]: pypi/release version not consistent with git repo for models #255

Closed JosephMontoya-TRI closed 1 month ago

JosephMontoya-TRI commented 1 month ago

Email (Optional)

No response

Version

1.0.0

Which OS(es) are you using?

What happened?

With a pip-installed matgl, loading models with new versions in the git repo (i.e. M3GNet-MP-2021.2.8-PES) throws errors related to e.g. new output params.

Could pin models to load from a tag that matches current version.

Code snippet

!pip install matgl

import matgl
matgl.load_model("M3GNet-MP-2021.2.8-PES")

Log output

Traceback (most recent call last):
8.986   File "/usr/local/lib/python3.10/site-packages/matgl/utils/io.py", line 212, in load_model
8.986     return cls_.load(fpaths, **kwargs)
8.986   File "/usr/local/lib/python3.10/site-packages/matgl/utils/io.py", line 129, in load
8.986     model = cls(**d)
8.986 TypeError: Potential.__init__() got an unexpected keyword argument 'calc_magmom'

Code of Conduct

shyuep commented 1 month ago

Thanks for reporting this. I will do a release soon. I am open to ideas on how to do versioning of models. In general, we support the latest version. Otherwise, we will spend way too much time versioning models and keep track of old models.

JosephMontoya-TRI commented 1 month ago

Perfect, thank you for the release!

Yeah, flexible versioning seems like a headache - and presumably coupling updates to the main branch with the release will prevent the issue since that's where the models are being loaded from in the code as far as I can tell.

If you really wanted to have a more strict loading of the same version as the installed code, my impulse would be to load the model by accessing the git url with the appropriate tag that corresponds to that currently installed version, which presumably would keep the model consistent with the version in the distributed case, but I'm not sure how that would affect the development or testing case. It also wouldn't work with prior versions, but could work with the versions released from now on.