mirror of
https://github.com/rasbt/LLMs-from-scratch.git
synced 2025-08-30 11:31:08 +00:00
Adjust comment to save compiled model (#583)
This commit is contained in:
parent
d4d420361c
commit
c9271ac427
@ -502,6 +502,12 @@ if __name__ == "__main__":
|
|||||||
plt.savefig("loss.pdf")
|
plt.savefig("loss.pdf")
|
||||||
|
|
||||||
# Save and load model
|
# Save and load model
|
||||||
|
#
|
||||||
|
# compiled = hasattr(model, "_orig_mod")
|
||||||
|
# if compiled:
|
||||||
|
# torch.save(model._orig_mod.state_dict(), "model.pth")
|
||||||
|
# else:
|
||||||
# torch.save(model.state_dict(), "model.pth")
|
# torch.save(model.state_dict(), "model.pth")
|
||||||
|
#
|
||||||
# model = GPTModel(GPT_CONFIG_124M)
|
# model = GPTModel(GPT_CONFIG_124M)
|
||||||
# model.load_state_dict(torch.load("model.pth", weights_only=True))
|
# model.load_state_dict(torch.load("model.pth", weights_only=True))
|
||||||
|
@ -598,6 +598,12 @@ if __name__ == "__main__":
|
|||||||
plt.savefig("loss.pdf")
|
plt.savefig("loss.pdf")
|
||||||
|
|
||||||
# Save and load model
|
# Save and load model
|
||||||
|
#
|
||||||
|
# compiled = hasattr(model, "_orig_mod")
|
||||||
|
# if compiled:
|
||||||
|
# torch.save(model._orig_mod.state_dict(), "model.pth")
|
||||||
|
# else:
|
||||||
# torch.save(model.state_dict(), "model.pth")
|
# torch.save(model.state_dict(), "model.pth")
|
||||||
|
#
|
||||||
# model = GPTModel(GPT_CONFIG_124M)
|
# model = GPTModel(GPT_CONFIG_124M)
|
||||||
# model.load_state_dict(torch.load("model.pth", weights_only=True))
|
# model.load_state_dict(torch.load("model.pth", weights_only=True))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user