-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feat: Upgrade tensorflow
to 2.16.1
and keras
to 3.4.0
#1385
Merged
RollerKnobster
merged 8 commits into
master
from
feature/rivan/163526-upgrade-tensorflow-and-keras
Jun 26, 2024
Merged
Feat: Upgrade tensorflow
to 2.16.1
and keras
to 3.4.0
#1385
RollerKnobster
merged 8 commits into
master
from
feature/rivan/163526-upgrade-tensorflow-and-keras
Jun 26, 2024
Commits on Jun 26, 2024
-
Feat: Upgrade
tensorflow
to2.16.1
andkeras
to3.4.0
To accommodate the upgrade, next changes to the code were made: * Since `keras 3.*` now clones the input `regressor` that is provided to the `BaseEstimator` into a `regressor_` attribute, and ONLY updates the `regressor_` one after fitting, metadata extraction in `gordo.builder.build_model.ModelBuilder` was changed to seek the `regressor_` in the `steps`. * Accessing `keras.optimizers` has changed in `keras 3.*` to having to use the `keras.optimizers.get` method and providing a `class_name` and `config` to deserialize. Relevant for lstm and feedforward autoencoders. * Model config now requires for `tensorflow.keras.models.Sequential` to define `input_shape` in its layers, otherwise model is not properly built after compiling and prior to fitting. Relevant for `KerasRawModelRegressor`. `KerasBaseEstimator` underwent the most changes. * We now need to run the `__init__` of the KerasRegressor with the expected `kwargs` for proper initialisation of the object, but the `kwargs` will always take precedence for `fit`, `predict` and `compile`, so they are mostly for making `keras` happy. * Saving model for pickling was changed ƒrom `h5` format, which is now considered legacy to `keras` native zip format, and the file is now stored to a temporary file and read into a buffer instead of using the `h5py` library, since `save_model` and `load_model` now exclusively expect an actual file instead of an io buffer. * Current implementation of model preparation for fit depends on the `__call__` method, which is no longer used in `keras 3.*`, and was changed to `_prepare_model` to replicate the same behaviour right before we call our own `fit` since it requires the `X` and `Y` to be present to set the `n_features` and `n_features_out`. * `History` is no longer returned from calling `fit` and must be extracted from under `model.history`. * Manually stored history now resides in `self._history` instead of `self.history` to avoid attribute name clash. Adjustments to tests were made: * `input_shape` now resides under `input.shape` in `model.layers`. * `optimizer_kwargs.lr` is now `optimizer_kwargs.learning_rate`
Configuration menu - View commit details
-
Copy full SHA for 225fb2f - Browse repository at this point
Copy the full SHA 225fb2fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6259b05 - Browse repository at this point
Copy the full SHA 6259b05View commit details -
Configuration menu - View commit details
-
Copy full SHA for c53efbf - Browse repository at this point
Copy the full SHA c53efbfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 29a715f - Browse repository at this point
Copy the full SHA 29a715fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9680e35 - Browse repository at this point
Copy the full SHA 9680e35View commit details -
Fix: remove
input_shape
from subsequent layers in `KerasRawModelReg……ressor` `layers`
Configuration menu - View commit details
-
Copy full SHA for d6ab506 - Browse repository at this point
Copy the full SHA d6ab506View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5733d98 - Browse repository at this point
Copy the full SHA 5733d98View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7ecaed7 - Browse repository at this point
Copy the full SHA 7ecaed7View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.