Posts

Post not yet marked as solved
11 Replies
6.2k Views
Hello, I cannot predict with my model on Apple M1. I get a error: Traceback (most recent call last):   File "/Users/martin/Documents/Projects/rl-toolkit/rl_toolkit/__main__.py", line 154, in <module>     agent.run()   File "/Users/martin/Documents/Projects/rl-toolkit/rl_toolkit/training.py", line 213, in run     losses = self._train(sample)   File "/Users/martin/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py", line 889, in __call__     result = self._call(*args, **kwds)   File "/Users/martin/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py", line 950, in _call     return self._stateless_fn(*args, **kwds)   File "/Users/martin/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/function.py", line 3023, in __call__     return graph_function._call_flat(   File "/Users/martin/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/function.py", line 1960, in _call_flat     return self._build_call_outputs(self._inference_function.call(   File "/Users/martin/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/function.py", line 591, in call     outputs = execute.execute(   File "/Users/martin/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation ReadVariableOp: Could not satisfy explicit device specification '' because the node {{colocation_node ReadVariableOp}} was colocated with a group of nodes that required incompatible device '/job:localhost/replica:0/task:0/device:GPU:0'. All available devices [/job:localhost/replica:0/task:0/device:CPU:0, /job:localhost/replica:0/task:0/device:GPU:0].  Colocation Debug Info: Colocation group had the following types and supported devices:  Root Member(assigned_device_name_index_=2 requested_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' assigned_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' resource_device_name_='/job:localhost/replica:0/task:0/device:GPU:0' supported_device_types_=[CPU] possible_devices_=[] ResourceApplyAdamWithAmsgrad: CPU  ReadVariableOp: GPU CPU  _Arg: GPU CPU  Colocation members, user-requested devices, and framework assigned devices, if any:   readvariableop_resource (_Arg)  framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0   adam_2_adam_update_6_resourceapplyadamwithamsgrad_m (_Arg)  framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0   adam_2_adam_update_6_resourceapplyadamwithamsgrad_v (_Arg)  framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0   adam_2_adam_update_6_resourceapplyadamwithamsgrad_vhat (_Arg)  framework assigned device=/job:localhost/replica:0/task:0/device:GPU:0   ReadVariableOp (ReadVariableOp)    Exp/ReadVariableOp (ReadVariableOp)    ReadVariableOp_1 (ReadVariableOp)    actor/ReadVariableOp (ReadVariableOp)    actor/Exp/ReadVariableOp (ReadVariableOp)    actor/ReadVariableOp_1 (ReadVariableOp)    actor_critic/actor/ReadVariableOp (ReadVariableOp)    actor_critic/actor/Exp/ReadVariableOp (ReadVariableOp)    actor_critic/actor/ReadVariableOp_1 (ReadVariableOp)    Adam_2/Adam/update_6/ResourceApplyAdamWithAmsgrad (ResourceApplyAdamWithAmsgrad) /job:localhost/replica:0/task:0/device:GPU:0 [[{{node ReadVariableOp}}]] [Op:__inference__train_4206]
Posted Last updated
.
Post not yet marked as solved
2 Replies
2.6k Views
Hi, OS: macOS 12.4 CPU: Apple M1 I cannot import the new TensorFlow 2.9.0 on Apple M1. I got an error: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Users/martin/Documents/Projects/Solar-Transformer/Testing.ipynb Cell 3' in <cell line: 1>() ----> 1 from tensorflow.keras.layers import Add, Dense, Dropout, Layer, LayerNormalization, MultiHeadAttention, Normalization 2 from tensorflow.keras.models import Model 3 from tensorflow.keras.initializers import TruncatedNormal File ~/miniforge3/lib/python3.9/site-packages/tensorflow/__init__.py:37, in <module> 34 import sys as _sys 35 import typing as _typing ---> 37 from tensorflow.python.tools import module_util as _module_util 38 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader 40 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import. File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/__init__.py:42, in <module> 37 from tensorflow.python.eager import context 39 # pylint: enable=wildcard-import 40 41 # Bring in subpackages. ---> 42 from tensorflow.python import data 43 from tensorflow.python import distribute 44 # from tensorflow.python import keras File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/data/__init__.py:21, in <module> 15 """`tf.data.Dataset` API for input pipelines. 16 17 See [Importing Data](https://tensorflow.org/guide/data) for an overview. 18 """ 20 # pylint: disable=unused-import ---> 21 from tensorflow.python.data import experimental 22 from tensorflow.python.data.ops.dataset_ops import AUTOTUNE 23 from tensorflow.python.data.ops.dataset_ops import Dataset File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/data/util/structure.py:22, in <module> 19 import six 20 import wrapt ---> 22 from tensorflow.python.data.util import nest 23 from tensorflow.python.framework import composite_tensor 24 from tensorflow.python.framework import ops File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/data/util/nest.py:36, in <module> 16 """## Functions for working with arbitrarily nested sequences of elements. 17 18 NOTE(mrry): This fork of the `tensorflow.python.util.nest` module (...) 31 arrays. 32 """ 34 import six as _six ---> 36 from tensorflow.python.framework import sparse_tensor as _sparse_tensor 37 from tensorflow.python.util import _pywrap_utils 38 from tensorflow.python.util import nest File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/framework/sparse_tensor.py:24, in <module> 22 from tensorflow.python import tf2 23 from tensorflow.python.framework import composite_tensor ---> 24 from tensorflow.python.framework import constant_op 25 from tensorflow.python.framework import dtypes 26 from tensorflow.python.framework import ops File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/framework/constant_op.py:25, in <module> 23 from tensorflow.core.framework import types_pb2 24 from tensorflow.python.eager import context ---> 25 from tensorflow.python.eager import execute 26 from tensorflow.python.framework import dtypes 27 from tensorflow.python.framework import op_callbacks File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/eager/execute.py:23, in <module> 21 from tensorflow.python import pywrap_tfe 22 from tensorflow.python.eager import core ---> 23 from tensorflow.python.framework import dtypes 24 from tensorflow.python.framework import ops 25 from tensorflow.python.framework import tensor_shape File ~/miniforge3/lib/python3.9/site-packages/tensorflow/python/framework/dtypes.py:29, in <module> 26 from tensorflow.python.lib.core import _pywrap_bfloat16 27 from tensorflow.python.util.tf_export import tf_export ---> 29 _np_bfloat16 = _pywrap_bfloat16.TF_bfloat16_type() 32 @tf_export("dtypes.DType", "DType") 33 class DType(_dtypes.DType): 34 """Represents the type of the elements in a `Tensor`. 35 36 `DType`'s are used to specify the output data type for operations which (...) 46 See `tf.dtypes` for a complete list of `DType`'s defined. 47 """ Example code: from tensorflow.keras.layers import Add, Dense, Dropout, Layer, LayerNormalization, MultiHeadAttention, Normalization from tensorflow.keras.models import Model from tensorflow.keras.initializers import TruncatedNormal from tensorflow.keras.utils import timeseries_dataset_from_array import tensorflow as tf import tensorflow_probability as tfp import numpy as np
Posted Last updated
.