Closed dkgaraujo closed 5 months ago
"could not find registered platform with id
" typically means that your TF runtime is not working. You can try to call keras.config.disable_traceback_filtering()
and run the code again to find out more.
I'm able to run on M1/M2 by just installing tensorflow-metal
and tensorflow-macos
.
Thanks. On Intel silicon, the tensorflow version runs as expected, but adapting it to Keras Core (by removing the tf import and the tf namespace, no further adjustment) yields the same error, even after disabling the traceback filtering.
The code runs without any issues on my M1. You can directly install tensorflow , since the release officially supports MacOS release build. Keras 3 is available now, you can install it as well and set your backend.
To install the packages:
pip install -U tensorflow
pip install -U keras
below code works well.
import keras
cifar = keras.datasets.cifar100
(x_train, y_train), (x_test, y_test) = cifar.load_data()
model = keras.applications.ResNet50(
include_top=True,
weights=None,
input_shape=(32, 32, 3),
classes=100,)
loss_fn = keras.losses.SparseCategoricalCrossentropy(from_logits=False)
model.compile(optimizer="adam", loss=loss_fn, metrics=["accuracy"])
model.fit(x_train, y_train, epochs=5, batch_size=64)
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.
Adjusting the functioning example code in the Apple instructions for Metal (MPS) acceleration with tensorflow to a
keras_core
implementation as shown below, the code snippet ceases to function. Code and error message provided below: