apple / tensorflow_macos

TensorFlow for macOS 11.0+ accelerated using Apple's ML Compute framework.
Other
3.67k stars 308 forks source link

python segmentation fault running basic convnet in cpu mode #107

Open djr1028 opened 3 years ago

djr1028 commented 3 years ago

On a Macbook Pro 16 (16 GB RAM, 2.3 Ghz 8-core, AMD 5500M 4GB), running this basic MNIST convnet Jupyter-lab notebook crashes python:

https://github.com/fchollet/deep-learning-with-python-notebooks/blob/master/5.1-introduction-to-convnets.ipynb

The only changes to the notebook above were that the following lines were added to the beginning of the notebook to change to 'cpu' mode, and instances of "import keras" and "from keras import ..." were modified to "from tensorflow import keras" and "from tensorflow.keras import ...":

from tensorflow.python.compiler.mlcompute import mlcompute;
mlcompute.set_mlc_device(device_name='cpu')

Python3 exits with "segmentation fault". It crashes during the execution of this line:

model.fit(train_images, train_labels, epochs=5, batch_size=64)

It only crashes when running tensorflow in 'cpu' mode AND when batch_size=64. If it's changed to 'gpu' mode, or if the batch_size is changed to 32, then it works fine.

anna-tikhonova commented 3 years ago

Thank you very much for reporting this. We will investigate and report back.