Tensorfow 2.2.0 on google colab

I am using Tensorflow v2.2.0 on a Raspberry Pi 4b with PiOS Buster (32-bit), with a self-driving RC car using this repo: GitHub - autorope/donkeycar: Open source hardware and software platform to build a small scale self driving car.

I would like to train the model using Google Colab, but when I install TFv2.2.0 on colab, it doesn’t find the GPU. If I leave the default TF installed (2.9.2), it does find the GPU and I have set the runtime to use the GPU.

I’m using this code to test for the GPU:

import tensorflow as tf
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
  raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))

Does anyone know if TF2.2.0 can work on Colab with GPU? Thanks!

Does anyone know if TF2.2.0 can work on Colab with GPU?

No, it’s due to incompatibility between CUDA and Tensorflow Version.

!nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0

Currently Colab has CUDA 11.2, so as per tested build configurations you can use TF2.5.

import tensorflow as tf
print(tf.__version__)
device_name = tf.test.gpu_device_name()
if device_name != '/device:GPU:0':
  raise SystemError('GPU device not found')
print('Found GPU at: {}'.format(device_name))

Output:

2.5.0
Found GPU at: /device:GPU:0

Please find the gist here for reference.

If you are interested in using TF2.2.0 then you should use CUDA 10.1 and cuDNN 7.6. Thank you.

2 Likes

Thank you that makes sense!
I have tried to downgrade CUDA and cuDNN to the specified versions but still have had no luck. Do you mind taking a look at this notebook and see if I need to do anything differently?

Thanks!

Hey Hi, Could you please share the colab file with cuDNN v7.0 for tensorflow 2.2.0? Thanks in advance.

Hey Hi, Could you please share the colab file with cuDNN v7.0 for tensorflow 2.2.0? Thanks in advance.

Try this one:

I was able to use the GPU with this.

@mexxmann the code installed correctly. But the GPU is not showing, and even the code uses CPU to train. Would you mind helping with this?