Skip to content

Conversation

@sampathweb
Copy link
Collaborator

@sampathweb sampathweb commented Mar 21, 2024

TensorFlow Nightly failed on import of Keras since jax becomes a requirement due to import.

+ /tmp/tmp.yijSXl7avZ/bin/python3 -c 'import sys; import tensorflow as tf; sys.exit(0 if "keras" in tf.keras.__name__ else 1)'
Traceback (most recent call last):
  File "/tmp/tmp.yijSXl7avZ/lib/python3.12/site-packages/tensorflow/python/util/lazy_loader.py", line 147, in _initialize
    import keras  # pylint: disable=g-import-not-at-top
    ^^^^^^^^^^^^
  File "/tmp/tmp.yijSXl7avZ/lib/python3.12/site-packages/keras/__init__.py", line 8, in <module>
    from keras import _tf_keras
  File "/tmp/tmp.yijSXl7avZ/lib/python3.12/site-packages/keras/_tf_keras/__init__.py", line 1, in <module>
    from keras._tf_keras import keras
  File "/tmp/tmp.yijSXl7avZ/lib/python3.12/site-packages/keras/_tf_keras/keras/__init__.py", line 61, in <module>
    from keras._tf_keras.keras import layers
  File "/tmp/tmp.yijSXl7avZ/lib/python3.12/site-packages/keras/_tf_keras/keras/layers/__init__.py", line 148, in <module>
    from keras.src.utils.jax_layer import FlaxLayer
  File "/tmp/tmp.yijSXl7avZ/lib/python3.12/site-packages/keras/src/utils/jax_layer.py", line 3, in <module>
    import jax
ModuleNotFoundError: No module named 'jax'

JaxLayer checks for backend, so moving this import should be no-op, but removes the need to have it installed in a TF backend.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Mar 21, 2024
@fchollet fchollet merged commit 08711c5 into keras-team:master Mar 21, 2024
@google-ml-butler google-ml-butler bot removed awaiting review ready to pull Ready to be merged into the codebase kokoro:force-run labels Mar 21, 2024
@sampathweb sampathweb deleted the jax-layer-import branch March 21, 2024 16:14
groszewn added a commit to tensorflow/tensorboard that referenced this pull request Mar 22, 2024
AnuarTB pushed a commit to AnuarTB/tensorboard that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Assigned Reviewer

Development

Successfully merging this pull request may close these issues.

3 participants