Zero'ing params docs

This commit is contained in:
Michael Cusack
2023-08-04 17:33:23 +07:00
parent dfff7812db
commit 305d920862
+4 -4
View File
@@ -6,10 +6,10 @@ inference with:
#include <torch/script.h> #include <torch/script.h>
torch::jit::Module module = torch::jit::load("model.pt") torch::jit::Module module = torch::jit::load("model.pt")
Note that the model includes the initial parameters and with default ModelArgs the Note that the serialized model includes the initial parameters and with the default
serialized model is 59M and gzips down to 55M. If you want to serialize/distribute the ModelArgs the file is 59M and gzips down to 55M. If you want to serialize/distribute
model parameters separately and the size of the model file you can zero out the the model parameters separately and you can zero out the parameters before saving it
parameters before saving it and it will gzip down to 780K: and it will gzip down to 780K:
for p in model.parameters(): for p in model.parameters():
p.detach().zero_() p.detach().zero_()
""" """