I just recreated my tensorflow-metal virtual environment on OS X 11.6. Now, when I import tensorflow, I am getting:
No supported GPU was found.
My AMD GPU worked in the prior versions of OS X 11.6.
Do the latest versions require OS X 12?
% ipython
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.28.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import tensorflow
No supported GPU was found.
% pip list
Package Version
------------------------ ---------
absl-py 0.12.0
anyio 3.3.2
appnope 0.1.2
argon2-cffi 21.1.0
astunparse 1.6.3
attrs 21.2.0
Babel 2.9.1
backcall 0.2.0
bleach 4.1.0
bokeh 2.3.3
cachetools 4.2.4
certifi 2021.5.30
cffi 1.14.6
charset-normalizer 2.0.6
clang 5.0
cloudpickle 2.0.0
cycler 0.10.0
Cython 0.29.24
debugpy 1.5.0
decorator 5.1.0
defusedxml 0.7.1
dill 0.3.4
distinctipy 1.1.5
dm-tree 0.1.6
entrypoints 0.3
flatbuffers 1.12
future 0.18.2
gast 0.4.0
gensim 3.8.3
google-auth 1.35.0
google-auth-oauthlib 0.4.6
google-pasta 0.2.0
googleapis-common-protos 1.53.0
grpcio 1.41.0
h5py 3.1.0
hdbscan 0.8.27
idna 3.2
importlib-resources 5.2.2
ipykernel 6.4.1
ipython 7.28.0
ipython-genutils 0.2.0
ipywidgets 7.6.5
jedi 0.18.0
Jinja2 3.0.2
joblib 1.1.0
json5 0.9.6
jsonschema 4.0.1
jupyter-client 7.0.6
jupyter-core 4.8.1
jupyter-server 1.11.1
jupyterlab 3.1.18
jupyterlab-pygments 0.1.2
jupyterlab-server 2.8.2
jupyterlab-widgets 1.0.2
keras 2.6.0
Keras-Preprocessing 1.1.2
kiwisolver 1.3.2
llvmlite 0.37.0
Markdown 3.3.4
MarkupSafe 2.0.1
matplotlib 3.4.3
matplotlib-inline 0.1.3
mistune 0.8.4
nbclassic 0.3.2
nbclient 0.5.4
nbconvert 6.2.0
nbformat 5.1.3
nest-asyncio 1.5.1
nmslib 2.1.1
notebook 6.4.4
numba 0.54.0
numpy 1.20.3
oauthlib 3.1.1
opt-einsum 3.3.0
packaging 21.0
pandas 1.3.3
pandocfilters 1.5.0
parso 0.8.2
pexpect 4.8.0
pickleshare 0.7.5
Pillow 8.3.2
pip 21.2.4
prometheus-client 0.11.0
promise 2.3
prompt-toolkit 3.0.20
protobuf 3.18.1
psutil 5.8.0
ptyprocess 0.7.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pybind11 2.6.1
pycparser 2.20
Pygments 2.10.0
pynndescent 0.5.4
pyparsing 2.4.7
pyrsistent 0.18.0
python-dateutil 2.8.2
pytz 2021.3
PyYAML 5.4.1
pyzmq 22.3.0
requests 2.26.0
requests-oauthlib 1.3.0
requests-unixsocket 0.2.0
rsa 4.7.2
scikit-learn 1.0
scipy 1.7.1
Send2Trash 1.8.0
setuptools 47.1.0
six 1.15.0
smart-open 5.2.1
sniffio 1.2.0
tabulate 0.8.9
tensorboard 2.6.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.6.0
tensorflow-consciousness 0.1
tensorflow-datasets 4.4.0
tensorflow-estimator 2.6.0
tensorflow-gan 2.1.0
tensorflow-hub 0.12.0
tensorflow-macos 2.6.0
tensorflow-metadata 1.2.0
tensorflow-metal 0.2.0
tensorflow-probability 0.14.1
tensorflow-similarity 0.13.45
tensorflow-text 2.6.0
termcolor 1.1.0
terminado 0.12.1
testpath 0.5.0
threadpoolctl 3.0.0
top2vec 1.0.26
tornado 6.1
tqdm 4.62.3
traitlets 5.1.0
typing-extensions 3.7.4.3
umap-learn 0.5.1
urllib3 1.26.7
wcwidth 0.2.5
webencodings 0.5.1
websocket-client 1.2.1
Werkzeug 2.0.2
wheel 0.37.0
widgetsnbextension 3.5.1
wordcloud 1.8.1
wrapt 1.12.1
zipp 3.6.0
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I am trying to profile a tensorflow 2.5 model with tensorflow-macos and tensorflow-metal.
I am getting this error:
AttributeError: module 'tensorflow.compat.v1.profiler' has no attribute 'experimental'
Here's a code snippet:
import tensorflow as tf
import numpy as np
from utils import *
tf.compat.v1.enable_v2_behavior()
from tensorflow.python.framework.ops import disable_eager_execution
disable_eager_execution()
options = tf.profiler.experimental.ProfilerOptions(host_tracer_level = 3,
python_tracer_level = 1,
device_tracer_level = 1)
tf.profiler.experimental.start('~/logdir', options=options)
...
tf.profiler.experimental.stop()
% pip list
Package Version
-------------------------- -------------------
absl-py 0.12.0
anyio 3.2.1
appnope 0.1.2
argon2-cffi 20.1.0
astunparse 1.6.3
async-generator 1.10
attrs 21.2.0
Babel 2.9.1
backcall 0.2.0
bleach 3.3.1
cachetools 4.2.2
certifi 2021.5.30
cffi 1.14.6
charset-normalizer 2.0.1
cloudpickle 1.6.0
cycler 0.10.0
Cython 0.29.24
debugpy 1.3.0
decorator 5.0.9
defusedxml 0.7.1
dill 0.3.4
dm-tree 0.1.6
dotmap 1.3.23
entrypoints 0.3
flatbuffers 1.12
future 0.18.2
gast 0.4.0
gensim 4.0.1
google-auth 1.32.1
google-auth-oauthlib 0.4.4
google-pasta 0.2.0
googleapis-common-protos 1.53.0
grpcio 1.34.1
gviz-api 1.9.0
gym 0.18.3
h5py 3.1.0
idna 3.2
importlib-resources 5.2.0
ipykernel 6.0.1
ipython 7.25.0
ipython-genutils 0.2.0
ipywidgets 7.6.3
jedi 0.18.0
Jinja2 3.0.1
json5 0.9.6
jsonschema 3.2.0
jupyter-client 6.1.12
jupyter-core 4.7.1
jupyter-server 1.9.0
jupyterlab 3.0.16
jupyterlab-pygments 0.1.2
jupyterlab-server 2.6.1
jupyterlab-widgets 1.0.0
keras-nightly 2.5.0.dev2021032900
Keras-Preprocessing 1.1.2
kiwisolver 1.3.1
Markdown 3.3.4
MarkupSafe 2.0.1
matplotlib 3.4.2
matplotlib-inline 0.1.2
memory-profiler 0.58.0
mistune 0.8.4
nbclassic 0.3.1
nbclient 0.5.3
nbconvert 6.1.0
nbformat 5.1.3
nest-asyncio 1.5.1
notebook 6.4.0
numpy 1.19.5
oauthlib 3.1.1
opt-einsum 3.3.0
packaging 21.0
pandas 1.3.0
pandocfilters 1.4.3
parso 0.8.2
pexpect 4.8.0
pickleshare 0.7.5
Pillow 8.2.0
pip 21.2.1
prometheus-client 0.11.0
promise 2.3
prompt-toolkit 3.0.19
protobuf 3.17.3
psutil 5.8.0
ptyprocess 0.7.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pybind11 2.6.2
pycparser 2.20
pyglet 1.5.15
Pygments 2.9.0
pyparsing 2.4.7
pyrsistent 0.18.0
python-dateutil 2.8.2
pytz 2021.1
pyzmq 22.1.0
requests 2.26.0
requests-oauthlib 1.3.0
requests-unixsocket 0.2.0
rsa 4.7.2
scipy 1.7.0
Send2Trash 1.7.1
setuptools 41.2.0
six 1.15.0
smart-open 5.1.0
sniffio 1.2.0
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-profile 2.4.0
tensorboard-plugin-wit 1.8.0
tensorflow-datasets 4.3.0
tensorflow-estimator 2.5.0
tensorflow-hub 0.12.0
tensorflow-macos 2.5.0
tensorflow-metadata 1.1.0
tensorflow-metal 0.1.1
tensorflow-probability 0.13.0
termcolor 1.1.0
terminado 0.10.1
testpath 0.5.0
tornado 6.1
tqdm 4.61.2
traitlets 5.0.5
typing-extensions 3.7.4.3
urllib3 1.26.6
wcwidth 0.2.5
webencodings 0.5.1
websocket-client 1.1.0
Werkzeug 2.0.1
wheel 0.36.2
widgetsnbextension 3.5.1
wrapt 1.12.1
zipp 3.5.0
I installed tensorflow-mac and tensorflow-metal on an iMac 2021 27" running Big Sur with an AMD Radeon Pro 5700 XT.
I am running Python 3.8.5
(tensorflow-metal) (base) davidlaxer@x86_64-apple-darwin13 ~ % pip list
Package Version Location
----------------------- ------------------- -------------------------
...
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.5.0
tensorflow-estimator 2.5.0
tensorflow-hub 0.12.0
tensorflow-macos 2.5.0
tensorflow-metal 0.1.1
tensorflow-text 2.5.0
When I try to import tensorflow I get this error:
% ipython
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.24.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import tensorflow
---------------------------------------------------------------------------
NotFoundError Traceback (most recent call last)
<ipython-input-1-d6579f534729> in <module>
----> 1 import tensorflow
~/tensorflow-metal/lib/python3.8/site-packages/tensorflow/__init__.py in <module>
447 _plugin_dir = _os.path.join(_s, 'tensorflow-plugins')
448 if _os.path.exists(_plugin_dir):
--> 449 _ll.load_library(_plugin_dir)
450 # Load Pluggable Device Library
451 _ll.load_pluggable_device_library(_plugin_dir)
~/tensorflow-metal/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py in load_library(library_location)
152
153 for lib in kernel_libraries:
--> 154 py_tf.TF_LoadLibrary(lib)
155
156 else:
NotFoundError: dlopen(/Users/davidlaxer/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
I am trying to get the AMD Radeon Pro 5700 XT GPU on my iMac 27" 2021 running Big Sur 11.4 to work with tensorflow-macos.
If I disable eager execution I get an exception, if I don't, tensorflow-macos choses the CPU and not the GPU.
Here's a simple example which shows the exception:
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text
import numpy as np
from sklearn.preprocessing import normalize
from tensorflow.python.framework.ops import disable_eager_execution
disable_eager_execution()
m4 = hub.load("/Users/davidlaxer/Downloads/universal-sentence-encoder_4")
english_sentences = ["dog", "Puppies are nice.", "I enjoy taking long walks along the beach with my dog."]
r4 = np.array(m4(english_sentences))
print(r4)
print(m4)
type(r4)
type(m4)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-4-8b0ba0e4c28c> in <module>
1 m4 = hub.load("/Users/davidlaxer/Downloads/universal-sentence-encoder_4")
2 english_sentences = ["dog", "Puppies are nice.", "I enjoy taking long walks along the beach with my dog."]
----> 3 r4 = np.array(m4(english_sentences))
4 print(r4)
5 print(m4)
~/anaconda3/envs/tensorflow_mac/lib/python3.8/site-packages/tensorflow/python/framework/ops.py in __array__(self)
850
851 def __array__(self):
--> 852 raise NotImplementedError(
853 "Cannot convert a symbolic Tensor ({}) to a numpy array."
854 " This error may indicate that you're trying to pass a Tensor to"
NotImplementedError: Cannot convert a symbolic Tensor (StatefulPartitionedCall_1:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported
And commenting out disable_eager_execution():
from tensorflow.python.framework.ops import disable_eager_execution
#disable_eager_execution()
m4 = hub.load("/Users/davidlaxer/Downloads/universal-sentence-encoder_4")
english_sentences = ["dog", "Puppies are nice.", "I enjoy taking long walks along the beach with my dog."]
r4 = np.array(m4(english_sentences))
print(r4)
print(m4)
type(r4)
type(m4)
[-0.06334164 -0.01812314 0.03680531 ... -0.02809388 0.02786911
-0.04715428]
[ 0.01975714 -0.02284616 0.04316505 ... -0.01376714 -0.00614742
-0.00124967]
[-0.02169351 -0.003993 0.06716524 ... 0.05952153 0.02262796
0.03501643]]
<tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject object at 0x7fbb3892a9a0>
[5]:
tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject
The tensorflow group does not support this GPU and the tensorflow-mac repository is now read-only.
https://github.com/tensorflow/tensorflow/issues/50353
https://github.com/apple/tensorflow_macos
Any ideas?
Details here:
https://stackoverflow.com/questions/68551935/why-does-my-tensorflow-model-stop-training
I can run the VariationalDeepSemantic Hashing model in an Anaconda python 3.85 virtual environment with tensorflow 2.5 on CPUs.
If I run the same code in the tensorflow-metal virtual environment with python 3.82, accessing my AMD Radeon Pro 5700 XT GPU, the process stops training at epoch 5 on the 5200 batch.
I am running tensorflow-macos and tensorflow-metal on Big Sur.
I am getting this error:
AttributeError: module 'tensorflow.keras' has no attribute 'utils_dataset_from_directory'
https://github.com/keras-team/keras-io/issues/12
Can I install tf_nightly? Or does it conflict with tensorflow-macos?
from tensorflow import keras
from tensorflow.python.framework.ops import disable_eager_execution
dataset = keras.utils_dataset_from_directory(
"celeba_gan",
label_mode=None,
image_size=(64, 64),
batch_size=32,
smart_resize=True)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/3n/56fpv14n4wj0c1l1sb106pzw0000gn/T/ipykernel_41859/2519466253.py in <module>
1 from tensorflow import keras
2 from tensorflow.python.framework.ops import disable_eager_execution
----> 3 dataset = keras.utils_dataset_from_directory(
4 "celeba_gan",
5 label_mode=None,
AttributeError: module 'tensorflow.keras' has no attribute 'utils_dataset_from_directory'