Same for me. After updating to Sonoma from Ventura my training runs 5 times slower than before. I also noticed that the GPU is no longer used, despite the message “2023-10-03 19:35:08.186175: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:117] Plugin optimizer for device_type GPU is enabled.”
I have installed and reinstalled tensorflow-metal, and if I run this code:
import tensorflow as tf
cifar = tf.keras.datasets.cifar100
(x_train, y_train), (x_test, y_test) = cifar.load_data()
model = tf.keras.applications.ResNet50(
include_top=True,
weights=None,
input_shape=(32, 32, 3),
classes=100,)
model.summary()
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=False)
model.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, batch_size=64)
I see from the activity monitor that the GPU is fully utilized.
However, when I run another training which took about 11 seconds per batch on Ventura, it now takes more than 56 seconds per batch, and the GPU is utilized only at around 20% (before it was up to 98%). I have also already set the optimizer to tf.keras.optimizers.legacy.Adam, as suggested by the warning. Still no success in recreating the performances experienced in MacOS Ventura.