keras icon indicating copy to clipboard operation
keras copied to clipboard

AttributeError: 'Functional' object has no attribute '_get_save_spec'

Open kerighan opened this issue 1 year ago • 7 comments

I get this error when trying to convert/quantize any .keras model using tflite (model was trained using TF):

converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_types = [tf.float16]
tflite_quant_model = converter.convert()

Traceback:

  input_signature = _model_input_signature(
  File "/[...]/tflite_keras_util.py", line 84, in model_input_signature
    input_specs = model._get_save_spec(  # pylint: disable=protected-access
AttributeError: 'Functional' object has no attribute '_get_save_spec'

kerighan avatar Jul 27 '23 09:07 kerighan