Skip to content

Conversation

mattdangerw
Copy link
Member

@mattdangerw mattdangerw commented Sep 27, 2023

Currently this is only available via github.
Eventually this will be available via pip install keras.
We need it now to support testing against the latest keras changes.

As part of this changes, we will also move our off any private, unexported symbols (no more keras_core.src).

@mattdangerw
Copy link
Member Author

/gcbrun

_MULTI_BACKEND = True

# If keras is version 3, use multi-backend keras (our only option).
_IS_KERAS_3 = version.parse(keras.__version__) >= version.parse("3.0.0")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reading of this is that if Keras3 is installed, we force use of Keras3 instead of tf.keras -- I think that's probably fine but want to make sure it's the intent so I can do the same on KerasCV

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we see Keras 3 as the main import keras we should probably just use it? I don't see a big reason to support a legacy path of import tf_keras, but we could always add it down the road.

It does not sounds like any package is going to directly depend on tf-keras, so I don't think we can rely on it being installed unless we add a dep at some point.

What do you think? Is there and alternative you were considering?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that seems reasonable.

My plan was to stick to the same behavior for now (using tf.keras unless a backend is specified), but I think we should move toward dropping support for tf.keras and instead use keras core only.

In fact, I'd support doing that as soon as the 0.7 releases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think overall this should be sticking to the same behavior. tf.keras (which is keras==2.x installed with tensorflow) is the default out of the box.

The issue is mainly that if a user does install Keras 3 (via source or eventual pip package), I don't think we can guarantee there is another keras to load. from tensorflow import keras will get you Keras 3 unless the user has manually done pip install tf-keras and TF_USE_LEGACY_KERAS.

@mattdangerw
Copy link
Member Author

/gcbrun

@mattdangerw mattdangerw force-pushed the support-keras-3-import branch from 95c75c8 to 28c4589 Compare September 27, 2023 19:05
@mattdangerw
Copy link
Member Author

/gcbrun

Currently this is only available via github.
Eventually this will be available via `pip install keras`.
We need it know to support testing against the latest keras changes.

As part of this changes, we will also move our off any private,
unexported symbols (no more keras_core.src).
@mattdangerw mattdangerw force-pushed the support-keras-3-import branch from 28c4589 to 9ebf0ed Compare October 9, 2023 18:57
@mattdangerw
Copy link
Member Author

/gcbrun

@mattdangerw mattdangerw force-pushed the support-keras-3-import branch from 43f2b8f to e310931 Compare October 9, 2023 20:50
@mattdangerw
Copy link
Member Author

/gcbrun

@mattdangerw mattdangerw merged commit f6d240b into keras-team:master Oct 9, 2023
mattdangerw added a commit to mattdangerw/keras-hub that referenced this pull request Nov 6, 2023
* Support Keras 3 installation

Currently this is only available via github.
Eventually this will be available via `pip install keras`.
We need it know to support testing against the latest keras changes.

As part of this changes, we will also move our off any private,
unexported symbols (no more keras_core.src).

* Fixes for whisper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants