Post

Replies

Boosts

Views

Activity

Cannot use XLA accelerator Tensorflow in M1 silicon
I'm trying to use XLA in TensorFlow using jit_compile=True, currently. However, the error looks like it cannot. First of all, I tried simple code as below, import tensorflow as tf @tf.function(jit_compile=True) def operation(a, b): return a * b And, I got an error as below, (base) ***@MacBook-Pro folder % /Users/***/miniforge3/envs/testtf/bin/python /Users/***/workplace/research/folder/subfolder/test/test_jit_compile.py Metal device set to: Apple M1 Pro systemMemory: 32.00 GB maxCacheSize: 10.67 GB 2023-01-11 12:45:18.794439: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:306] Could not identify NUMA node of platform GPU ID 0, defaulting to 0. Your kernel may not have been built with NUMA support. 2023-01-11 12:45:18.794689: I tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc:272] 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: <undefined>) 2023-01-11 12:45:18.808796: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at xla_ops.cc:418 : NOT_FOUND: could not find registered platform with id: 0x10c7ba7e0 Traceback (most recent call last): File "/Users/***/workplace/research/folder/subfolder/test/test_jit_compile.py", line 25, in <module> print(operation(3, 4)) File "/Users/***/miniforge3/envs/testtf/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler raise e.with_traceback(filtered_tb) from None File "/Users/***/miniforge3/envs/testtf/lib/python3.8/site-packages/tensorflow/python/eager/execute.py", line 52, in quick_execute tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.NotFoundError: could not find registered platform with id: 0x10c7ba7e0 [Op:__inference_operation_5] This seems like XLA did not register. Would you guide how to use jit_compile=True in this environment? I attached my environment as below also. Package Version ----------------------- --------- absl-py 1.3.0 astunparse 1.6.3 cachetools 5.2.1 certifi 2022.12.7 charset-normalizer 2.1.1 flatbuffers 23.1.4 gast 0.4.0 google-auth 2.16.0 google-auth-oauthlib 0.4.6 google-pasta 0.2.0 grpcio 1.42.0 h5py 3.6.0 idna 3.4 importlib-metadata 6.0.0 keras 2.11.0 libclang 15.0.6.1 Markdown 3.4.1 MarkupSafe 2.1.1 numpy 1.22.3 oauthlib 3.2.2 opt-einsum 3.3.0 packaging 23.0 pip 22.3.1 protobuf 3.19.6 pyasn1 0.4.8 pyasn1-modules 0.2.8 requests 2.28.1 requests-oauthlib 1.3.1 rsa 4.9 setuptools 65.6.3 six 1.16.0 tensorboard 2.11.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.1 tensorflow-estimator 2.11.0 tensorflow-macos 2.11.0 tensorflow-metal 0.7.0 termcolor 2.2.0 typing_extensions 4.4.0 urllib3 1.26.13 Werkzeug 2.2.2 wheel 0.37.1 wrapt 1.14.1 zipp 3.11.0 Thanks.
3
0
2.6k
Jan ’23
Cannot run tensorflow-macos-2.10.0
When I tried to run Onnx, it needs the version of tensorflow above 2.10. So I install tensorflow-macos-2.10.0 and run, but it cannot run and had a error as below Successfully installed tensorflow-macos-2.10.0 (mlp) seunghyunoh@MacBook-Pro-OSH ~ % python Python 3.8.13 (default, Mar 28 2022, 06:13:39)  [Clang 12.0.0 ] :: Anaconda, Inc. on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow  RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf ImportError: numpy.core.multiarray failed to import The above exception was the direct cause of the following exception: SystemError: <built-in method __contains__ of dict object at 0x112b7b1c0> returned a result with an error set The above exception was the direct cause of the following exception: Traceback (most recent call last):   File "<stdin>", line 1, in <module>   File "/Users/seunghyunoh/miniforge3/envs/mlp/lib/python3.8/site-packages/tensorflow/__init__.py", line 37, in <module>     from tensorflow.python.tools import module_util as _module_util   File "/Users/seunghyunoh/miniforge3/envs/mlp/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 37, in <module>     from tensorflow.python.eager import context   File "/Users/seunghyunoh/miniforge3/envs/mlp/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 35, in <module>     from tensorflow.python.client import pywrap_tf_session   File "/Users/seunghyunoh/miniforge3/envs/mlp/lib/python3.8/site-packages/tensorflow/python/client/pywrap_tf_session.py", line 19, in <module>     from tensorflow.python.client._pywrap_tf_session import * ImportError: initialization failed I am using M1 MacPro and previously, tensorflow-macos-2.9.1 worked well. Please check this part and I hope it will be solved.
2
0
2k
Sep ’22