Usage:Training procedure remains the same.
After training, add the lines to check if there's anything wrong and try to save.
try:
logging.info("Scripting the model with TorchScript")
scripted_model = torch.jit.script(cace_nnp)
print(f"Successfully scripted full_model")
scripted_model.save("water-model-scripted.pt")
logging.info("Model successfully scripted and saved as 'water-model-scripted.pt'")
except Exception as e:
logging.error(f"Error scripting the model: {e}")
logging.error(traceback.format_exc())
If there's any problem with torchscripting, please inform me immediately
Now the trained potential is 'Torchscriptable'
Usage: Training procedure remains the same. After training, add the lines to check if there's anything wrong and try to save.
If there's any problem with torchscripting, please inform me immediately