Zero'ing params docs

This commit is contained in:
Michael Cusack
2023-08-04 17:31:11 +07:00
parent d4cdd6259e
commit 34f0402501
+6 -5
View File
@@ -2,14 +2,15 @@
#!/usr/bin/env python
"""Saves the model as a TorchScript.
The resulting file can be loaded in C++ code and then used for training or inference with:
The resulting file can be loaded in C++ code and then used for training or
inference with:
#include <torch/script.h>
torch::jit::Module module = torch::jit::load("model.pt")
Note that the model includes the initial parameters and with default ModelArgs the serialized model
is 59M and gzips down to 55M. If you want to serialize/distribute the model parameters separately
and the size of the model file you can zero out the parameters before saving it and it will gzip
down to 780K:
Note that the model includes the initial parameters and with default ModelArgs the
serialized model is 59M and gzips down to 55M. If you want to serialize/distribute the
model parameters separately and the size of the model file you can zero out the
parameters before saving it and it will gzip down to 780K:
for p in model.parameters():
p.detach().zero_()
"""