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