Summary:
I have noticed low test accuracy during and after training Tensorflow LSTM models on M1-based Macs with tensorflow-metal/GPU. While I have observed this over more than one model, I chose to use a standard Github repo to reproduce the problem, utilizing a community and educational example based on the Sequential Models Course, Deep Learning Specialization (Andrew Ng).
Steps to Reproduce:
-
git clone https://github.com/omerbsezer/LSTM_RNN_Tutorials_with_Demo.git
-
cd LSTM_RNN_Tutorials_with_Demo/SentimentAnalysisProject
-
python main.py
-
Results
Test accuracy (CPU only, without tensorflow-metal): ~83% Test accuracy (GPU using tensorflow-metal): ~37%
A similar pattern can be observed in epoch steps for accuracy, loss etc.
System Details
- Model: Macbook Pro (16-inch, 2021)
- Chip: Apple M1 Max
- Memory: 64GB
- OS: MacOS 12.0.1
- Key Libraries: tensforflow-metal (0.2), tensorflow-macos (2.6.0), python (3.9.7)