You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working on upgrading my Keras 2 code to just work with Keras 3 without going fully back-end agnostic. However, while everything works fine after resolving compatibility, my training speed has severely degraded by maybe even a factor 10. I've changed the following to get Keras 3 working:
Changed tensorflow.keras to keras calls.
Updated model/weights saving and loading to use the new export function and weights.h5 format.
Updated a callback at the end of the epoch to be a keras.Callback instead of the old BaseLogger.
Added @keras.saving.register_keras_serializable() to custom metric and loss functions.
Updated my online dataset generator to use keras.Sequential data augmentation instead of the removed ImageDataGenerator.
Removed the max_queue_size kwarg from the model.fit and model.predict calls since it has been removed.
In terms of hardware/packages, I'm using Python 3.11.10, keras 3.5.0 and Tensorflow 2.16.2 on a Macbook Pro M2. I've also noticed that my GPU and CPU usage is much higher while running the newer version. I've confirmed using git stash that specifically the changes mentioned above are causing the performance degradation. My suspicion is that the Apple hardware is somehow resulting in worse performance, but I've yet to confirm it using a regular x86 machine.
The text was updated successfully, but these errors were encountered:
Currently the code uses custom generators, but when I rewrite it to use tf.data.Dataset the performance stays the same. In terms of CPU/GPU usage, my system does not show any major differences:
I've been working on upgrading my Keras 2 code to just work with Keras 3 without going fully back-end agnostic. However, while everything works fine after resolving compatibility, my training speed has severely degraded by maybe even a factor 10. I've changed the following to get Keras 3 working:
tensorflow.keras
tokeras
calls.export
function andweights.h5
format.keras.Callback
instead of the oldBaseLogger
.@keras.saving.register_keras_serializable()
to custom metric and loss functions.keras.Sequential
data augmentation instead of the removedImageDataGenerator
.max_queue_size
kwarg from themodel.fit
andmodel.predict
calls since it has been removed.In terms of hardware/packages, I'm using Python 3.11.10, keras 3.5.0 and Tensorflow 2.16.2 on a Macbook Pro M2. I've also noticed that my GPU and CPU usage is much higher while running the newer version. I've confirmed using
git stash
that specifically the changes mentioned above are causing the performance degradation. My suspicion is that the Apple hardware is somehow resulting in worse performance, but I've yet to confirm it using a regular x86 machine.The text was updated successfully, but these errors were encountered: