I use macOS Sonoma version 14.1 and Apple M2 Pro. Regarding the combo python 3.9, tensorflow 2.14.0 (or 2.14.1) and tensorflow-metal 1.1.0, the training proceeds as follows:
Epoch 1/50
431/431 [==============================] - 166s 222ms/step - loss: 0.2384 - sparse_categorical_accuracy: 0.9313 - val_loss: 0.2923 - val_sparse_categorical_accuracy: 0.9290
Epoch 2/50
431/431 [==============================] - 136s 315ms/step - loss: 0.1056 - sparse_categorical_accuracy: 0.9671 - val_loss: 0.1287 - val_sparse_categorical_accuracy: 0.9568
Epoch 3/50
431/431 [==============================] - 1062s 2s/step - loss: 0.0835 - sparse_categorical_accuracy: 0.9719 - val_loss: 0.1326 - val_sparse_categorical_accuracy: 0.9596
Epoch 4/50
431/431 [==============================] - 419s 972ms/step - loss: 0.0863 - sparse_categorical_accuracy: 0.9721 - val_loss: 0.1155 - val_sparse_categorical_accuracy: 0.9629
Epoch 5/50
431/431 [==============================] - 166s 383ms/step - loss: 0.1069 - sparse_categorical_accuracy: 0.9691 - val_loss: 0.1385 - val_sparse_categorical_accuracy: 0.9555
In a nutshell, the training is ridiculously slow and the loss does not really decrease, but either increases of stagnates to a really bad level.
If I use python 3.9, tensorflow 2.13.0 and tensorflow-metal 0.5.1 instead, the training is fast, and proceeds as expected:
Epoch 1/50
431/431 [==============================] - 16s 34ms/step - loss: 0.1884 - sparse_categorical_accuracy: 0.9306 - val_loss: 0.0764 - val_sparse_categorical_accuracy: 0.9668
Epoch 2/50
431/431 [==============================] - 16s 34ms/step - loss: 0.0665 - sparse_categorical_accuracy: 0.9746 - val_loss: 0.0529 - val_sparse_categorical_accuracy: 0.9790
Epoch 3/50
431/431 [==============================] - 16s 35ms/step - loss: 0.0517 - sparse_categorical_accuracy: 0.9798 - val_loss: 0.0516 - val_sparse_categorical_accuracy: 0.9795
Epoch 4/50
431/431 [==============================] - 16s 35ms/step - loss: 0.0453 - sparse_categorical_accuracy: 0.9825 - val_loss: 0.0397 - val_sparse_categorical_accuracy: 0.9842
Epoch 5/50
431/431 [==============================] - 16s 35ms/step - loss: 0.0418 - sparse_categorical_accuracy: 0.9839 - val_loss: 0.0372 - val_sparse_categorical_accuracy: 0.9858
but the terminal gets filled by the following error messages:
loc(“mps_select”(“(mpsFileLoc): /AppleInternal/Library/BuildRoots/495c257e-668e-11ee-93ce-926038f30c31/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShadersGraph/mpsgraph/MetalPerformanceShadersGraph/Core/Files/MPSGraphUtilities.mm”:294:0)): error: ‘anec.gain_offset_control’ op result #0 must be 4D/5D memref of 16-bit float or 8-bit signed integer or 8-bit unsigned integer values, but got ‘memref<1x1x1x1xi1>’