atomistic-machine-learning / schnetpack

SchNetPack - Deep Neural Networks for Atomistic Systems
Other
791 stars 215 forks source link

spktrain not able to save model #630

Closed gulsumgudukbay closed 6 months ago

gulsumgudukbay commented 6 months ago

When I try to run spktrain script (calls the train function in cli.py), the execution progresses fine until line best_task = type(task).load_from_checkpoint(best_path) within the train function. Hence, the best model is not saved. The error I am getting is: [2024-05-03 12:56:00,341][schnetpack.cli][INFO] - Best checkpoint path: checkpoints/epoch=756.ckpt [2024-05-03 12:56:00,341][schnetpack.cli][INFO] - Store best model Error executing job with overrides: ['experiment=qm9_atomwise'] Traceback (most recent call last): File "/home/gulsum/.local/lib/python3.10/site-packages/schnetpack/cli.py", line 418, in train best_task = type(task).load_from_checkpoint(best_path) File "/home/gulsum/.local/lib/python3.10/site-packages/pytorch_lightning/core/module.py", line 1552, in load_from_checkpoint loaded = _load_from_checkpoint( File "/home/gulsum/.local/lib/python3.10/site-packages/pytorch_lightning/core/saving.py", line 89, in _load_from_checkpoint model = _load_state(cls, checkpoint, strict=strict, **kwargs) File "/home/gulsum/.local/lib/python3.10/site-packages/pytorch_lightning/core/saving.py", line 156, in _load_state obj = cls(**_cls_kwargs) TypeError: AtomisticTask.__init__() missing 1 required positional argument: 'model'

jnsLs commented 6 months ago

Dear @gulsumgudukbay,

could you please try to pull the latest version of schnetpack. There was a bug in one of our earlier commits that might be the reason for this error.

Best, Jonas

jnsLs commented 6 months ago

Dear @gulsumgudukbay

did this solve your issue?

Best, Jonas

gulsumgudukbay commented 6 months ago

Hi Jonas, sorry I forgot to reply. Yes now the model is saved successfully. I load the model using torch model load and continue training or testing using the model instance.

jnsLs commented 6 months ago

Thank you for your contribution :) I will close this issue then.