Cael
Cael

Reputation: 41

cannot import name 'TFLiteConverter'?

I am using Colab (Tensorflow version 1.15.0, and Python 3 notebook) to import TFLiteConverter using the following code:

from tensorflow.lite import TFLiteConverter

converter = lite.TFLiteConverter.from_saved_model('/drive/My Drive/FSD_modelV09A.h5')
tflite_model = converter.convert()
open("/drive/My Drive/FSD_modelV09A.tflite", "wb").write(tflite_model)

and this error happened:

ImportError: cannot import name 'TFLiteConverter'

I'm referring this documentation

Upvotes: 1

Views: 1182

Answers (1)

Rajat Agarwal
Rajat Agarwal

Reputation: 184

from tensorflow import lite

converter = lite.TFLiteConverter.from_saved_model('/drive/My Drive/FSD_modelV09A.h5')
tflite_model = converter.convert()
open("/drive/My Drive/FSD_modelV09A.tflite", "wb").write(tflite_model)

This should work.

Upvotes: 1

Related Questions