chore: add example for saving/loading models from checkpoints

This commit is contained in:
Jensun Ravichandran 2022-02-02 19:02:26 +01:00
parent d5855dbe97
commit 98892afee0
No known key found for this signature in database
GPG Key ID: 7612C0CAB643D921

View File

@ -53,3 +53,11 @@ if __name__ == "__main__":
# Training loop # Training loop
trainer.fit(model, train_loader) trainer.fit(model, train_loader)
# Manual save
trainer.save_checkpoint("./glvq_iris.ckpt")
# Load saved model
new_model = pt.models.GLVQ.load_from_checkpoint(
checkpoint_path="./glvq_iris.ckpt")
print(new_model)