Relative Content

Tag Archive for tensorflow-litequantization-aware-training

Quantization Aware Training: ValueError: `to_quantize` can only either be a keras Sequential or Functional model

I’m Trying to test Quantization Aware Trainin from TensorFlow Lite. The following source code creates an AI model (variable: model) trained with the MNIST dataset (just 1 epoch for testing purpose). I saved after the model in a file (model.h5). When I’m creating a Quantization Aware model named q_aware_model directly from the model variable with the quantize_model method, it works.
But when I’m loading my model stored in the model.h5 file and trying a Quantization Aware model named q_aware_model1, it fails with error:
q_aware_model1 = quantize_model1(model1)
ValueError: to_quantize can only either be a keras Sequential or Functional model.