# Where is the quantized param saved?

**URL:** <https://discuss.pytorch.org/t/where-is-the-quantized-param-saved/179728>\
**Category:** quantization\
**Created:** [May 11, 2023, 7:59pm UTC](https://discuss.pytorch.org/t/where-is-the-quantized-param-saved/179728 "2023-05-11T19:59:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SenJia](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/senjia/32/60428_2.png) [@SenJia](https://discuss.pytorch.org/u/SenJia)\
**Post date:** [May 11, 2023, 7:59pm UTC](https://discuss.pytorch.org/t/where-is-the-quantized-param-saved/179728/1 "2023-05-11T19:59:27Z")

</div>

Hi, I am using the dynamic quantization on my model, and trying to compute the size reduced. I suppose the number of parameters before and after quantization should be the same, only the number of bits used is changed. However, when I check the model state\_dict or parameters, the quantized is not there, and it is not in the buffer. I was trying to estimate the model size by numel \* element\_size, but it seems the quantized param cannot be found. I saw the document for pruning that I can compute the number of pruned params based on zeros in the \_mask in the buffer, but I cannot find docs about how the quantized param is saved. Could anyone please help here, thanks.

---

<div class="post-metadata">

**Author:** ![jcaip](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/jcaip/32/53908_2.png) [@jcaip](https://discuss.pytorch.org/u/jcaip)\
**Post date:** [May 15, 2023, 3:27pm UTC](https://discuss.pytorch.org/t/where-is-the-quantized-param-saved/179728/2 "2023-05-15T15:27:47Z")

</div>

Hi @SenJia, can you share the code you are using to quantize / save the model?

---

<div class="post-metadata">

**Author:** ![HDCharles](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/hdcharles/32/38408_2.png) [@HDCharles](https://discuss.pytorch.org/u/HDCharles)\
**Post date:** [May 15, 2023, 8:59pm UTC](https://discuss.pytorch.org/t/where-is-the-quantized-param-saved/179728/3 "2023-05-15T20:59:41Z")

</div>

see this tutorial:

[https://pytorch.org/tutorials/advanced/dynamic\_quantization\_tutorial.html](https://pytorch.org/tutorials/advanced/dynamic_quantization_tutorial.html)

which includes a method for looking at the size of the model.

in general the quantized weight is not simply saved as a quantized tensor with X elements each having Y bits, rather it has to be saved as packedparams which include other intermediate values needed by the quantized matmul to speed up quantization.
