As we know experimental_list_devices is removed from tensorflow, so i got an error:
AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_devices'
when creating 'Sequential' model.
It is happened as i understood beacause tf.config.experimental_list_devices()
tf.__version__ is: 2.1.0
tf.keras.__version__ is: 2.2.4-tf
experimental_list_devices is deprecated in tf 2.1,use tf.config.list_logical_devices replaced.
`
def _get_available_gpus():
"""Get a list of available gpu devices (formatted as strings).
# Returns
A list of available GPU devices.
"""
global _LOCAL_DEVICES
if _LOCAL_DEVICES is None:
if _is_tf_1():
devices = get_session().list_devices()
_LOCAL_DEVICES = [x.name for x in devices]
else:
devices = tf.config.list_logical_devices()
_LOCAL_DEVICES = [x.name for x in devices]
return [x for x in _LOCAL_DEVICES if 'device:gpu' in x.lower()]
`
Same problem here, AlphaWu solution works. I have created a pull request
I solve this by installing an older version
I solve this by installing an older version
which version of Keras is downgraded? and which version of Tensorflow?
I solve this by installing an older version
which version of Keras is downgraded? and which version of Tensorflow?
Hello, I think better solution is an injection.
import tensorflow as tf
import keras.backend.tensorflow_backend as tfback
...ba bla
print("tf.__version__ is", tf.__version__)
print("tf.keras.__version__ is:", tf.keras.__version__)
def _get_available_gpus():
"""Get a list of available gpu devices (formatted as strings).
# Returns
A list of available GPU devices.
"""
#global _LOCAL_DEVICES
if tfback._LOCAL_DEVICES is None:
devices = tf.config.list_logical_devices()
tfback._LOCAL_DEVICES = [x.name for x in devices]
return [x for x in tfback._LOCAL_DEVICES if 'device:gpu' in x.lower()]
tfback._get_available_gpus = _get_available_gpus
it is working fine for me, even in jupyter notebooks
Had the same problem, fixed it with a simple argument
model.add(MaxPooling2D(2,2, dim_ordering='tf'))
dim_ordering ='th'
gave me the previous error, replacing it with 'tf' fixed it.
This code is working on my colab notebook
import tensorflow as tf
import keras.backend.tensorflow_backend as tfback
print("tf.__version__ is", tf.__version__)
print("tf.keras.__version__ is:", tf.keras.__version__)
def _get_available_gpus():
"""Get a list of available gpu devices (formatted as strings).
# Returns
A list of available GPU devices.
"""
#global _LOCAL_DEVICES
if tfback._LOCAL_DEVICES is None:
devices = tf.config.list_logical_devices()
tfback._LOCAL_DEVICES = [x.name for x in devices]
return [x for x in tfback._LOCAL_DEVICES if 'device:gpu' in x.lower()]
tfback._get_available_gpus = _get_available_gpus
the problem has not solved when i train my net in the colab
504 if tfback._LOCAL_DEVICES is None:
505 devices = tf.config.list_logical_devices()
--> 506 tfback._LOCAL_DEVICES = [x.name for x in devices]
507 return [x for x in tfback._LOCAL_DEVICES if 'device:gpu' in x.lower()]
508
AttributeError: module 'tensorflow._api.v2.config' has no attribute 'experimental_list_devices'
@JingCi-ZHu same for me , plz if you've found a solution can you share it with me ?
what's the error in these?
fork11 = Convolution2D(nb_filters_1, nb_conv_init, nb_conv_init, activation="relu")(init)
fork12 = Convolution2D(nb_filters_1, nb_conv_init, nb_conv_init, activation="relu")(init)
showing error::AttributeError: module 'tensorflow_core._api.v2.config' has no attribute 'experimental_list_device
@nmodem2k i tried the solution which is in this link and it works for me https://www.kaggle.com/vitost/kernel-keras-injection-sol might it helps u
I am getting this error.plz help
@nmodem2k add those 2 lignes before the function
import tensorflow as tf
import keras.backend.tensorflow_backend as tfback
do you solve it now?
@JingCi-ZHu for me it works , i followed the instructions given in this website https://www.kaggle.com/vitost/kernel-keras-injection-sol
@JingCi-ZHu @wissam-bouattou yeah it worked for me too
I solve this by installing an older version
i am having build problem with older version any suggestions?
Use tf.keras instead of keras with tf 2.1.0
On May 18, 2020, at 4:14 PM, dagger112 notifications@github.com wrote:
I solve this by installing an older version
i am having build problem with older version any suggestions?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/keras-team/keras/issues/13684#issuecomment-630210229, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALL5BYDNORSDIOD2WVZ4BNTRSE7E5ANCNFSM4KFE7NMQ.
list_logical_devices()
It occurs another ERROR:'LogicalDevice' object has no attribute 'lower'
experimental_list_devices is deprecated in tf 2.1,use tf.config.list_logical_devices replaced.
`
def _get_available_gpus():
"""Get a list of available gpu devices (formatted as strings).# Returns A list of available GPU devices. """ global _LOCAL_DEVICES if _LOCAL_DEVICES is None: if _is_tf_1(): devices = get_session().list_devices() _LOCAL_DEVICES = [x.name for x in devices] else: devices = tf.config.list_logical_devices() _LOCAL_DEVICES = [x.name for x in devices] return [x for x in _LOCAL_DEVICES if 'device:gpu' in x.lower()]
`
I am still getting the same error after using "tf.config.list_logical_device". I am running it on google colab. Plz help me.
I solved this problem using pip install -U sensorflow-gpu
.
list_logical_devices()
It occurs another ERROR:'LogicalDevice' object has no attribute 'lower'
I am also facing the same issue!! Did anyone else find a solution for this?
Most helpful comment
Hello, I think better solution is an injection.
it is working fine for me, even in jupyter notebooks