This code reproduces the crash ...
Post
Replies
Boosts
Views
Activity
This code reproduces the crash ```In [2]: import tensorflow as tf
...:
...: mnist = tf.keras.datasets.mnist
...:
...: (x_train, y_train), (x_test, y_test) = mnist.load_data()
...: x_train, x_test = x_train / 255.0, x_test / 255.0
...:
...: model = tf.keras.models.Sequential([
...: tf.keras.layers.Flatten(input_shape=(28, 28)),
...: tf.keras.layers.Dense(128, activation='relu'),
...: tf.keras.layers.Dropout(0.2),
...: tf.keras.layers.Dense(10)
...: ])
...:
...: predictions = model(x_train[:1]).numpy()
...: tf.nn.softmax(predictions).numpy()
...:
...: loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True
...: )
...:
...: loss_fn(y_train[:1], predictions).numpy()
...:
...: model.compile(optimizer = 'adam', loss = loss_fn)
...: model.fit(x_train, y_train, epochs=100)
Epoch 1/100
2021-10-10 10:50:53.503460: I tensorflow/core/grappler/optimizers/custom_graph_optimizer_registry.cc:112] Plugin optimizer for device_type GPU is enabled.
2021-10-10 10:50:53.527 python[25080:3485800] -[MPSGraph adamUpdateWithLearningRateTensor:beta1Tensor:beta2Tensor:epsilonTensor:beta1PowerTensor:beta2PowerTensor:valuesTensor:momentumTensor:velocityTensor:gradientTensor:name:]: unrecognized selector sent to instance 0x6000037975a0
zsh: segmentation fault ipython
I installed the latest versions of tensorflow-macos and tensorflow-metal on OS X 11.6.
Now, it no longer prints out that it's using metal or my AMD GPU.
% ipython
In [3]: import tensorflow
No supported GPU was found.
I installed the latest versions from PyPi into my existing tensorflow-metal virtual environement with:
% pip install tensorflow-macos==2.6.0
% pip install tensorflow-metal=0.2.0
What's changed? Do I need to recreate the tensorflow-metal virtual environment from scratch?
% pip show tensorflow-metal
Name: tensorflow-metal
Version: 0.2.0
Summary: TensorFlow acceleration for Mac GPUs.
Home-page: https://developer.apple.com/metal/tensorflow-plugin/
Author:
Author-email:
License: MIT License. Copyright © 2020-2021 Apple Inc. All rights reserved.
Location: /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages
Requires: wheel, six
Required-by:
(tensorflow-metal) (base) davidlaxer@x86_64-apple-darwin13 Top2Vec % pip show tensorflow-macos
Name: tensorflow-macos
Version: 2.6.0
Summary: TensorFlow is an open source machine learning framework for everyone.
Home-page: https://www.tensorflow.org/
Author: Google Inc.
% pip show
tensorboard 2.6.0
tensorboard-data-server 0.6.1
tensorboard-plugin-profile 2.5.0
tensorboard-plugin-wit 1.8.0
tensorflow 2.6.0
tensorflow-consciousness 0.1
tensorflow-datasets 4.3.0
tensorflow-determinism 0.3.0
tensorflow-estimator 2.6.0
tensorflow-gan 2.1.0
tensorflow-hub 0.12.0
tensorflow-macos 2.6.0
tensorflow-metadata 1.1.0
tensorflow-metal 0.2.0
tensorflow-probability 0.13.0
tensorflow-similarity 0.13.45
tensorflow-text 2.6.0
I was able to profile keras/tensorflow example code with a tensorflow-metal virtual environment. Please note the profile tab will only display results in Google Chrome. In Safari the Profile tab was empty.
Fixed with tensorflow-metal version 0.1.2
I got this error with (tensorflow-metal) virtualenv on Big Sur with an AMD Radeon 5700 XT GPU
tensorflow-metal/lib/python3.8/site-packages/tensorflow-plugins/libmetal_plugin.dylib, 6): Symbol not found: _TF_AssignUpdateVariable
Referenced from: /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages/tensorflow-plugins/libmetal_plugin.dylib
Expected in: flat namespace
$ nm /Users/davidlaxer/tensorflow-metal/lib/python3.8/site-packages/tensorflow-plugins/libmetal_plugin.dylib | grep _TF_AssignUpdateVariable
U _TF_AssignUpdateVariable