How to get obtain the size (MB) of the BERT (TernaryBERT and BinaryBERT)
xwuShirley opened this issue · comments
xwuShirley commented
Dear Authors of TernaryBERT and BinaryBERT,
Thanks for the great work. I have tried my best to figure out the number you put in the table here
The BERT-base model (fp32) is
embedding_param = 23835648
num_param = 85526016 (here I only get the matrices)
(embedding_param + num_param) / 1e6 * 4 =437.4MB instead of 418MB?
for n, p in model.items():
if 'Norm' in n:
continue
if len(p.size()) ==2 :
if 'embedding' in n:
embedding_param += p.numel()
else:
num_param += p.numel()
It would be great if you can clarify this. Similar repo htqin/BiBERT#3 (comment)
xwuShirley commented
found the error should be (embedding_param + num_param) / (1024*1024) * 4 =437.4MB