Adjust comment to save compiled model (#583)

This commit is contained in:
Sebastian Raschka 2025-03-27 10:43:45 -05:00 committed by GitHub
parent f01e163aad
commit 2e143f17b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -502,6 +502,12 @@ if __name__ == "__main__":
plt.savefig("loss.pdf")
# Save and load model
# torch.save(model.state_dict(), "model.pth")
#
# compiled = hasattr(model, "_orig_mod")
# if compiled:
# torch.save(model._orig_mod.state_dict(), "model.pth")
# else:
# torch.save(model.state_dict(), "model.pth")
#
# model = GPTModel(GPT_CONFIG_124M)
# model.load_state_dict(torch.load("model.pth", weights_only=True))

View File

@ -598,6 +598,12 @@ if __name__ == "__main__":
plt.savefig("loss.pdf")
# Save and load model
# torch.save(model.state_dict(), "model.pth")
#
# compiled = hasattr(model, "_orig_mod")
# if compiled:
# torch.save(model._orig_mod.state_dict(), "model.pth")
# else:
# torch.save(model.state_dict(), "model.pth")
#
# model = GPTModel(GPT_CONFIG_124M)
# model.load_state_dict(torch.load("model.pth", weights_only=True))