Post

Replies

Boosts

Views

Activity

Reply to Tensorflow on M1 Macbook Pro, error when model fit executes
@marlonmin you can use TF 2.11 and tensorflow-metal 0.7 if you use the legacy Adam optimizer. I tried it by modifying the simple script from https://developer.apple.com/metal/tensorflow-plugin/ to use the legacy Adam optimizer in the model.compile step, and then was successfully able to train the model in their simple script. 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) model.compile(optimizer=tf.keras.optimizers.legacy.Adam(learning_rate=1e-3), loss=loss_fn, metrics=["accuracy"]) ##### THIS IS THE CHANGED LINE model.fit(x_train, y_train, epochs=5, batch_size=64)
Jan ’23