Error: AttributeError: module ‘tensorflow’ has no attribute ‘lite’

Hi!
I’m recycling old motherboards that need to use tensorflow version 1.5.
When I use tflite, it gives an error.

Thanks for any help.

import tensorflow as tf

interpreter = tf.lite.Interpreter(model_path='model.tflite')  # ERROR

Error:
interpreter = tf.lite.Interpreter(model_path=‘model.tflite’)
AttributeError: module ‘tensorflow’ has no attribute ‘lite’

Maybe the lite object wasn’t available on that version of TF.
Can you try using at least 1.15?

Hi Igusm!

I’ll try 1.15 version.

Thank you!

pip3 uninstall tensorflow

pip3 install tensorflow==1.15
Successfully installed gast-0.2.2 keras-applications-1.0.8 tensorboard-1.15.0 tensorflow-1.15.0 tensorflow-estimator-1.15.1

On Python 3.6.9:
import tensorflow as tf
Illegal instruction

Python should be at least 3.7

It’s crazy!

There is an error on translate english-portuguese:

I’ll try with Python 3.9
Thank you!

Testing on Python 3.7:
Python 3.7.5 (default, Dec 9 2021, 17:04:37)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import tensorflow
Illegal instruction

Thanks for pointing that out!

regarding the illegal instruction, I think your CPU (that you mentioned is old) might not have support for AVX. That would explain why it worked on TF 1.5 and not 1.15!

the solution would be to compile TF from source.

more information here: Illegal instruction (core dumped) after running import tensorflow · Issue #17411 · tensorflow/tensorflow · GitHub

(last comment @mihaimaruseac to more precise)

2 Likes