I finally got it working as follows:
python -m pip uninstall tensorflow-macos
python -m pip uninstall tensorflow-metal
conda install -c apple tensorflow-deps --force-reinstall
python -m pip install tensorflow-macos
python -m pip install tensorflow-metal
which gave me the currently latest versions
tensorflow-deps 2.10.0
tensorflow-macos 2.11.0
tensorflow-metal 0.7.1
No tensorflow-deps 2.11.0 is available at time of writing.
The Apple Developer test script is outdated and can be adjusted to use legacy Adam as follows:
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,)
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
opt = tf.keras.optimizers.legacy.Adam(learning_rate=0.001)
model.compile(loss=loss_fn, optimizer=opt, metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, batch_size=64)
This works now and model.fit was run in appr. 4m10s on M2 Pro Mac Mini.