Search code examples
pythontensorflowgoogle-colaboratory

Google Colab GPU: []


I am working with the maskrcnn model in google colab. I select GPU from the runtime section.

import tensorflow as tf
print(tf.__version__)
print(tf.test.gpu_device_name())
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

Output:

2.18.0-dev20240613
/device:GPU:0
Num GPUs Available:  1

And I checked there is no problem here.

When I set up the requirements for maskrcnn, !pip install -r /content/maskrcnn/requirements.txt

2.14.0

Num GPUs Available:  0

GPU disappeared.

requirements.txt

cython==3.0.5
h5py==3.9.0
imgaug==0.4.0
ipython==7.34.0
ipython-genutils==0.2.0
ipython-sql==0.5.0
keras==2.14.0
matplotlib==3.7.1
numpy==1.23.5
opencv-contrib-python==4.8.0.76
opencv-python==4.8.0.76
pillow==9.4.0
scikit-image==0.19.3
scipy==1.11.3
tensorboard==2.14.1
tensorflow==2.14.0

I don't understand why the GPU is disappearing. Does anyone have any ideas ? Thank you, Best wishes.


Solution

  • See your requements.txt there is tensorflow==2.14.0 - so it could uninstall your tensorflow 2.18 (which works with GPU) and install tensorflow 2.14.0 which maybe has problem with GPU.

    So you have to install tensorflow 2.18 again.