Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade tensorflow with GPU on google colaboratory

Currently google colaboratory uses tensorflow 1.4.1. I want to upgrade it to 1.5.0 version. Each time when i executed !pip install --upgrade tensorflow command, notebook instance succesfully upgrades the tensorflow version to 1.5.0. But after upgrade operation tensorflow instance only supports "CPU".

When i have executed this command it shows nothing :

from tensorflow.python.client import device_lib device_lib.list_local_devices()

Should there be another way for upgrading tensorflow ? such as upgrading to tensorflow-gpu package ? Also when will notebooks will come with upgraded tensorflows ?

like image 739
AGP Avatar asked Feb 11 '18 11:02

AGP


People also ask

How do I find the version of TensorFlow on Google Colab?

To check your TensorFlow version in your Jupyter Notebook such as Google's Colab, use the following two commands: import tensorflow as tf This imports the TensorFlow library and stores it in the variable named tf . print(tf. __version__) This prints the installed TensorFlow version number in the format x.y.z .


1 Answers

As of 2020, Colab can run Tensorflow 2.0. Uninstall the current version of Tensorflow:

!pip uninstall tensorflow

and simply reinstall using pip.

!pip install tensorflow==2.0.0

If you so choose, you can also install the beta version with

!pip install tensorflow==2.0.0-beta1

Once you've reinstalled Tensorflow, make sure you don't forget to restart the runtime under the Runtime tab.

A native solution is to start your code with

%tensorflow_version 2.x
like image 168
DickyBrown Avatar answered Oct 03 '22 06:10

DickyBrown