-
-
Save AkiyonKS/120389c87bb1c1480095798221090176 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_gzipped_model_size(file): | |
# Returns size of gzipped model, in bytes. | |
import os | |
import zipfile | |
_, zipped_file = tempfile.mkstemp('.zip') | |
with zipfile.ZipFile(zipped_file, 'w', compression=zipfile.ZIP_DEFLATED) as f: | |
f.write(file) | |
return os.path.getsize(zipped_file) | |
print("Size of gzipped baseline Keras model: %.2f bytes" % (get_gzipped_model_size(keras_file))) | |
print("Size of gzipped pruned Keras model: %.2f bytes" % (get_gzipped_model_size(pruned_keras_file))) | |
print("Size of gzipped pruned TFlite model: %.2f bytes" % (get_gzipped_model_size(pruned_tflite_file))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment