I have a tensorflow saved model with float32
weights in a directory structure like below,
large_model\
variables\
variables.data-00000-of-00001 (3.6GB)
variables.index
saved_model.pb
I would like to cast all weight to float16
in order to reduce the size of the model. I have found tf.cast()
method that can be applied to tensors. But it seems that there is no such method for casting the whole weights of a model. I guess that I have to read all layers of the model one by one and manually cast the weight to float16
and then save it using model.save()
, but I don’t know how to do that.
Note1: I do NOT have access to the python code of the model definition, only the saved model.
Note2: I do NOT want to save it as tflite
format.