Example to save and reload a model

This commit is contained in:
Jensun Ravichandran
2021-05-10 14:30:02 +02:00
parent ed03ab168e
commit 49100f43f5
2 changed files with 12 additions and 0 deletions

View File

@@ -37,3 +37,12 @@ if __name__ == "__main__":
# Training loop
trainer.fit(model, train_loader)
# Save the model
torch.save(model, "liramlvq_tecator.pt")
# Load a saved model
saved_model = torch.load("liramlvq_tecator.pt")
# Display the Lambda matrix
saved_model.show_lambda()