materialsvirtuallab / matgl

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

[Bug]: ValueError: Bad serialized model or bad model name. It is possible that you have an older model cached. Please clear your cache by running `python -c "import matgl; matgl.clear_cache()"` #326

Closed dShado94 closed 1 month ago

dShado94 commented 1 month ago

Email (Optional)

slepavicius.justinas@gmail.com

Version

0.9.2

Which OS(es) are you using?

What happened?

I have a fully working install on a device. However now I am trying to install it on a different device, and am stuck on this error. I copied all the versions from the working one to the new one, but no luck. I don't know where to look for issues at anymore.

Here are the only libraries that didn't get the exact versions, could it be one of these: datasets 2.17.0 depends on pandas evaluate 0.4.1 depends on pandas fastparquet 2024.2.0 depends on pandas>=1.5.0 mace-torch 0.3.4 depends on pandas pymatgen 2024.2.8 depends on pandas seaborn 0.13.2 depends on pandas>=1.2 transform 1.2.0 depends on pandas<1.5.0 and >=0.24.2

I have not done anything to the model, I just download it from github via the loadmodel method and it doesnt work. Clearing the cache did the same thing.

Any help is greatly appreciated.

Code snippet

No response

Log output

/home/justinaspoklius/.local/lib/python3.10/site-packages/torchdata/datapipes/__init__.py:18: UserWarning: 
################################################################################
WARNING!
The 'datapipes', 'dataloader2' modules are deprecated and will be removed in a
future torchdata release! Please see https://github.com/pytorch/data/issues/1196
to learn more and leave feedback.
################################################################################

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

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/justinaspoklius/COD_Project/CIFRelax/CoolerRelaxCIF.py", line 32, in <module>
    pot = matgl.load_model('M3GNet-MP-2021.2.8-PES')
  File "/home/justinaspoklius/.local/lib/python3.10/site-packages/matgl/utils/io.py", line 214, in load_model
    raise ValueError(
ValueError: Bad serialized model or bad model name. It is possible that you have an older model cached. Please clear your cache by running `python -c "import matgl; matgl.clear_cache()"`
justinaspoklius@Poklius:~/COD_Project/CIFRelax$ python -c "import matgl; print(matgl.__version__)"

Code of Conduct

kenko911 commented 1 month ago

Hi @dShado94, it seems that you are calling the latest version of MatGL (version:1.1.3) pretrained models from the Github repo. Please try to reinstall the latest version of MatGL instead of 0.9.2.

dShado94 commented 1 month ago

That worked! Thank you!