[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x600000eede10

I am running tensorflow-macos and tensorflow-metal version 2.6 on Monterey Beta (21A5543b) on an iMac 27" 2021 with an AMD Radeon GPU.

I got the following error training the model VariationalDeepSemanticHashing e.g.

2021-10-09 13:05:14.521286: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:112] Plugin optimizer for device_type GPU is enabled.

2021-10-09 13:05:27.092823: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:112] Plugin optimizer for device_type GPU is enabled.

2021-10-09 13:05:27.153 python[6315:1459657] -[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x600000eede10

[I 2021-10-09 13:05:28.157 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), keep random ports

kernel d25e6066-74f7-4b4a-b5e7-b2911e7501d9 restarted

https://github.com/unsuthee/VariationalDeepSemanticHashing/blob/master/Run_Experiment_Unsupervised.ipynb

Here's the repository:

https://github.com/unsuthee/VariationalDeepSemanticHashing

I have the same problem,my env, Monterey 12.2.1, tensorflow-macos 2.8.0,tersorflow-metal 0.4.0

I too am experiencing this problem when running on a 2017 Macbook Pro with AMD Radeo 560X.

I have the same problem: Adam optimizer would not work. Although SGD works, it does not actually optimize anything, i.e. loss does not improve over epochs.

Intel iMac 27 (2020, AMD Radeon Pro 5500 XT)

[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x60002836b9c0

Versions are as following:

tensorflow-macos: tensorflow_macos-2.8.0-cp38-cp38-macosx_11_0_x86_64
tensor flow-metal: tensorflow_metal-0.4.0-cp38-cp38-macosx_11_0_x86_64
python: 3.8
macOS: 12.3

I have also tried to roll back tensorflow-macos to 2.7 and tensorflow-metal to 0.3.0, as well as mix&match them. Nothing worked.

Meanwhile, my M1 MacBook Pro works without any problem with the following:

tensorflow-macos: tensorflow_macos-2.8.0-cp39-cp39-macosx_11_0_arm64
tensorflow-metal: tensorflow_metal-0.4.0-cp39-cp39-macosx_11_0_arm64
python: 3.9
macOS: 12.3

Since intel Mac does not have cp39 version for tensorflow-metal, I have no way to test if it is a Python problem or a macOS 12.3 problem.

Hope Apple solves this soon.

I have a similar issue with kernel crashing with Adam:

Model: "sequential"


Layer (type) Output Shape Param #

masking (Masking) (None, 1, 28) 0

layer1 (Bidirectional) (None, 1, 128) 47616

dropout (Dropout) (None, 1, 128) 0

layer2 (Bidirectional) (None, 1, 128) 98816

dropout_1 (Dropout) (None, 1, 128) 0

layer3 (Bidirectional) (None, 128) 98816

Output (Dense) (None, 1) 129

================================================================= Total params: 245,377 Trainable params: 245,377 Non-trainable params: 0


Epoch 1/3000 2022-03-29 13:26:54.863499: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.

**2022-03-29 13:26:57.201 python[66880:3338950] -[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x600041707c60 ** zsh: segmentation fault python test.py

I tried swapping Adam for RMSprop - still get an error - but now it's a floating point error.

2022-03-29 13:35:35.219059: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:305] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support. 2022-03-29 13:35:35.219398: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:271] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 0 MB memory) -> physical PluggableDevice (device: 0, name: METAL, pci bus id: ) Model: "sequential"


Layer (type) Output Shape Param #

masking (Masking) (None, 1, 28) 0

layer1 (Bidirectional) (None, 1, 128) 47616

dropout (Dropout) (None, 1, 128) 0

layer2 (Bidirectional) (None, 1, 128) 98816

dropout_1 (Dropout) (None, 1, 128) 0

layer3 (Bidirectional) (None, 128) 98816

Output (Dense) (None, 1) 129

================================================================= Total params: 245,377 Trainable params: 245,377 Non-trainable params: 0


Epoch 1/3000 2022-03-29 13:35:51.773828: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:35:55.049448: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:35:55.409149: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:35:58.358459: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:35:58.544457: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:35:58.809214: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:35:58.989445: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:36:01.117681: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled. 2022-03-29 13:36:01.338093: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:113] Plugin optimizer for device_type GPU is enabled.

zsh: floating point exception python test.py

I have that exact same problem:

[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x60002836b9c0

I tried switching Adam to RMSprop and then I get floating point exception.

I encountered a similar problem on an iMac with a 3.6GHz quad-core Intel Core i7 and Radeon Pro 560 4 GB. Adam crashes repeatedly. I tried using tfa.optimizer.RectifiedAdam instead. It works (and uses the GPU!) but it is significantly slower than Adam on the CPU. The HuggingFace glue/mrpc fine-tuning example takes ~15min per epoch on the CPU, but over an hour on the GPU.

[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x600000eede10
 
 
Q