aiqm / torchani

Accurate Neural Network Potential on PyTorch
https://aiqm.github.io/torchani/
MIT License
459 stars 126 forks source link

Incompatible/Unclear documentation for loading models #567

Closed ajsmit24 closed 3 years ago

ajsmit24 commented 3 years ago

I am attempting to train a custom model using the code from this tutorial which saves the best model as 'best.pt' using torch.save. However, I was attempting to load this model based on this documentation, but it implements jit which does not seem to be compatible. Therefore I was wondering how one would load and use the best.pt model.

IgnacioJPickering commented 3 years ago

@ajsmit24 both the builtin models and models that you create using torchani.nn.Sequential as in the first tutorial you linked are JIT compatible, I'm not sure what you mean, are you having issues with JIT?

IgnacioJPickering commented 3 years ago

If you jit script a model you load and save the model using torch.jit.load/torch.jit.save. If you don't jit script a model you use torch.load/torch.save directly. This is unrelated to our library, it is the way torch implements this, you can check here for more info https://pytorch.org/tutorials/beginner/saving_loading_models.html