I can import preprocessing:
from tensorflow.keras.layers.experimental import preprocessing
But I can't import or use any of the layers inside it:
from tensorflow.keras.layers.experimental.preprocessing import StringLookup
ImportError Traceback (most recent call last)
<ipython-input-78-4f042fcbcc66> in <module>
----> 1 from tensorflow.keras.layers.experimental.preprocessing import StringLookup
ImportError: cannot import name 'StringLookup' from 'tensorflow.keras.layers.experimental.preprocessing' (/home/julie/miniconda3/envs/tf-gpu/lib/python3.8/site-packages/tensorflow/keras/layers/experimental/preprocessing/__init__.py)
I found several resources citing versions as the issue. My environment is running:
Both were installed through conda.
The only solution that worked for me is:
pip install tensorflow==2.6.0
pip install keras==2.6.0
By bringing both tf and keras to 2.6.0