Keras/TF model file size vs PyTorch

I implemented a standard Inception-V3 for custom image classification in both Keras/TF2 and PyTorch. Both give similar accuracy and loss value. I notice that the model file sizes are very different. In TF2 saved checkpoint files, the file size is 25M. After saving to a h5 file, it becomes 9M. However, in PyTorch, the model file is 85M. I calculate the number of parameters,

The TF/Keras model has number of parameters 21,780,646.
The PyTorch model has number of parameters 21,797,286.
If every parameter is 4 byte, then PyTorch file size is 21,797,286*4/1024**2 = 83.8 MB.

I am wondering how the Keras/TF makes the saved model file size as small as 9M? I look up everywhere online but cannot find an answer. Is the Keras/TF using variable length for the parameters?

Thanks a lot.

Maybe TF/Keras is compressing the data. The TF discussion board might be a better place to ask this.

are you saving as state dic? that takes more space I think ? @ptrblck

That only changes the file size a little bit. I am talking about Keras’ 9M vs. PyTorch’s 87M.