Home > Mobile >  'str' object has no attribute 'call' when converting .model to tflite file
'str' object has no attribute 'call' when converting .model to tflite file

Time:03-10

I have been following this tutorial to perform voice command recognition for a couple words on my ESP32: https://github.com/atomic14/voice-controlled-robot

I was able to train my model and have the "fully_trained.model" file: "fully_trained.model"

Currently I am trying to convert the .model file into the tflite file, however I am getting the "'str' has no attribute 'call'" error: Code, Code, Errors

My tensorflow version is 2.6.2 and python version is 3.10.

Unfortunately, I do not have 10 reputation points yet, so I couldnt embed the images.

CodePudding user response:

If you use tf.lite.TFLiteConverter.from_keras_model you need to pass the tf.keras.Model instance, not the path to the saved_model folder.

Use tf.lite.TFLiteConverter.from_saved_model() instead and pass the path to the "fully_trained.model" folder.

CodePudding user response:

You've passed "fully_trained.model", with quotation marks, as an argument to TFLiteConverter. That's a string. Give the model a name and pass that name as an argument to the converter, without quotation marks.

  • Related