Some error appears when I used model.fit(), using tensorflow2.5 on m1

When I fit the data, the loss didn't decrease. Using the same codes on windows PC, I can get right results . And other codes including fit() also can't work and faced the same error.

The errors shows the followings : 2021-07-29 16:55:02.257192: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:176] None of the MLIR Optimization Passes are enabled (registered 2) 2021-07-29 16:55:02.258033: W tensorflow/core/platform/profile_utils/cpu_utils.cc:128] Failed to get CPU frequency: 0 Hz 2021-07-29 16:55:02.339241: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:112] Plugin optimizer for device_type GPU is enabled.

And the codes are : import tensorflow as tf import numpy as np from tensorflow import keras from matplotlib import pyplot as plt model = tf.keras.Sequential([keras.layers.Dense(units=1, input_shape=[1])]) model.compile(optimizer='sgd', loss='mean_squared_error') xs = np.array([-1.0, 0.0, 1.0, 2.0, 3.0, 4.0], dtype=float) ys = np.array([-3.0, -1.0, 1.0, 3.0, 5.0, 7.0], dtype=float) model.fit(xs, ys, epochs=500)

which version of MacOS are you using ? (it is recommended to use MacOS 12.0)

Hi @Alwaysvvv, If you are using 12.0, can you mention which beta version you are on ?

When I tried locally on a M1 machine I saw follow loss values printed out. One more thing you can try is to upgrade the tensorflow-metal plugin to 0.1.2 version and see if that helps.

1/1 [==============================] - 1s 660ms/step - loss: 1.1620

Epoch 2/500

1/1 [==============================] - 0s 3ms/step - loss: 1.0447

Epoch 3/500

1/1 [==============================] - 0s 3ms/step - loss: 0.9497

Epoch 4/500

1/1 [==============================] - 0s 3ms/step - loss: 0.8723

Epoch 5/500

1/1 [==============================] - 0s 3ms/step - loss: 0.8089

Epoch 6/500

1/1 [==============================] - 0s 3ms/step - loss: 0.7565

Epoch 7/500

1/1 [==============================] - 0s 2ms/step - loss: 0.7128

Epoch 8/500

1/1 [==============================] - 0s 2ms/step - loss: 0.6759

I have same problem as like mentioned above. Although, I have also updated OS which is version 12.1. After the upgrade , I run my source code however still there are problem as like before. I am so much disappointed with m1 Mac. Please kindly give us any possible solution regrading this issuse.

Hi @nasif391, The issue above seemed to be related to not upgrading to OS 12.0. I ran the provided and it was converging fine as posted in a previous post. Are you seeing Model converging issues ? Can you provide a repro case of the network ? Also which Tensorflow and Metal plugin versions you are on?.

Kulin

Some error appears when I used model.fit(), using tensorflow2.5 on m1
 
 
Q