Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: import autokeras as ak --> ModuleNotFoundError: No module named 'tensorflow.keras.layers.experimental' #1906

Open
Aya121298 opened this issue Mar 12, 2024 · 10 comments

Comments

@Aya121298
Copy link

Bug Description

ModuleNotFoundError: No module named 'tensorflow.keras.layers.experimental'

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 8>()
6 from keras.utils import to_categorical
7 import numpy as np
----> 8 import autokeras as ak
9 import matplotlib.pyplot as plt
10 plt.style.use('fivethirtyeight')

7 frames
/usr/local/lib/python3.10/dist-packages/autokeras/keras_layers.py in
18 from tensorflow import nest
19 from tensorflow.keras import layers
---> 20 from tensorflow.keras.layers.experimental import preprocessing
21
22 from autokeras.utils import data_utils

ModuleNotFoundError: No module named 'tensorflow.keras.layers.experimental'

Bug Reproduction

Code for reproducing the bug:

Data used by the code:
!pip install autokeras
import tensorflow as tf
import numpy as np
import autokeras as ak

Expected Behavior

The expected behavior is for the code to run as there are dependencies that depend on the library

Setup Details

Include the details about the versions of:

  • OS type and version: google colab
  • Python: Python 3
  • autokeras:
  • keras-tuner:
  • scikit-learn:
  • numpy:
  • pandas:
  • tensorflow:

Additional context

WARNING:tensorflow:From /usr/local/lib/python3.10/dist-packages/tensorflow/python/autograph/pyct/static_analysis/liveness.py:83: Analyzer.lamba_check (from tensorflow.python.autograph.pyct.static_analysis.liveness) is deprecated and will be removed after 2023-09-23.
Instructions for updating:
Lambda fuctions will be no more assumed to be used in the statement where they are used, or at least in the same block. tensorflow/tensorflow#56089

@Kinddor
Copy link

Kinddor commented Mar 13, 2024

I have the same problem.

@haifeng-jin
Copy link
Collaborator

You can either downgrade the TensorFlow version to less than 2.16. Or Use 2.16 or above versions of TensorFlow and install the corresponding tf_keras, and then export the environment variable TF_USE_LEGACY_KERAS=1.

AutoKeras does not support Keras 3 yet.

@diramazioni
Copy link

@haifeng-jin this works for me ty

@Aya121298
Copy link
Author

Aya121298 commented Mar 14, 2024 via email

@Aya121298
Copy link
Author

Aya121298 commented Mar 14, 2024 via email

@Aya121298
Copy link
Author

@haifeng-jin this works for me ty

does the execution go all the way?

@Aya121298
Copy link
Author

I tried using the tensorflow==2.15.0 and restarted the kernel, imported os and the tensorflow amc it worked.
Thank you

@keesh0
Copy link

keesh0 commented Jun 6, 2024

Installing tensorflow==2.15.0 worked for me too.

@GuidoBartoli
Copy link

GuidoBartoli commented Jun 20, 2024

AutoKeras does not support Keras 3 yet.

Is there any update or estimation on this? We switched to TensorFlow 2.16 some weeks ago and it would be really nice to keep using AutoKeras with it.

@sohang3112
Copy link

sohang3112 commented Oct 15, 2024

You can either downgrade the TensorFlow version to less than 2.16. Or Use 2.16 or above versions of TensorFlow and install the corresponding tf_keras, and then export the environment variable TF_USE_LEGACY_KERAS=1.

AutoKeras does not support Keras 3 yet.

@haifeng-jin This doesn't seem to be mentioned in the docs anywhere - it should be mentioned there.

Also is there currently any open issue for Keras 3 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants