Skip to content Skip to sidebar Skip to footer

Tensorflow 2.0rc Not Detecting Gpus

TF2 is currently not detecting GPUs, I migrated from TF1.14 where using tf.keras.utils.multi_gpu_model(model=model, gpus=2) is now returning an error ValueError: To call `multi_

Solution 1:

I would suggest you to-

  1. Please first check your Cuda version. Make sure it is 10.0.

  2. If that is 10.0, then check your TF version if it is for GPU or not.

  3. Check if TF can access the GPUs using the command

value = tf.test.is_gpu_available(
    cuda_only=False,
    min_cuda_compute_capability=None
)
print ('***If TF can access GPU: ***\n\n',value) # MUST RETURN True IF IT CAN!!
  1. I assume first 2 points are already taken care of by you. If TF can also access your GPUs then, as you can see in your Value error, it has names of GPUs actually. I can not say about tf.keras.utils.multi_gpu_model() function because I did not use it in TF. But I would suggest you to use with tf.device('/gpu:0'):. Inside this you call your model or define the model.
  2. If point 4 also doesn't work, then just add following lines
import osos.environ["CUDA_VISIBLE_DEVICES"] = "0,1,2,3" # 0,1,2,3 are number of GPUs

at the top of your file and remove with tf.device('/gpu:0')

Solution 2:

CUDA should be the version 10.0, not 10.1

Post a Comment for "Tensorflow 2.0rc Not Detecting Gpus"