Did colab suspend tensorflow 1.x?

Viewed 4184

I tried

%tensorflow_version 1.15

I used this code a couple days ago, but it doesn't work anymore since today.

The outcomes are

ValueError                                Traceback (most recent call last)
<ipython-input-6-24c52e77c597> in <module>()
----> 1 get_ipython().magic('tensorflow_version 1.15')

2 frames
/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py in magic(self, arg_s)
   2158         magic_name, _, magic_arg_s = arg_s.partition(' ')
   2159         magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2160         return self.run_line_magic(magic_name, magic_arg_s)
   2161 
   2162     #-------------------------------------------------------------------------

/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py in run_line_magic(self, magic_name, line)
   2079                 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
   2080             with self.builtin_trap:
-> 2081                 result = fn(*args,**kwargs)
   2082             return result
   2083 

/usr/local/lib/python3.7/dist-packages/google/colab/_tensorflow_magics.py in _tensorflow_version(line)
     39 
     40              Your notebook should be updated to use Tensorflow 2.
---> 41              See the guide at https://www.tensorflow.org/guide/migrate#migrate-from-tensorflow-1x-to-tensorflow-2."""
     42                        ))
     43 

ValueError: Tensorflow 1 is unsupported in Colab.

Your notebook should be updated to use Tensorflow 2.
See the guide at https://www.tensorflow.org/guide/migrate#migrate-from-tensorflow-1x-to-tensorflow-2.

Is there any method I can try to fix it or does it means that colab will not support tensorflow 1.x anymore?

2 Answers

As other answers and comments suggest, Google Colab removed support for Tensorflow 1, and it is not possible to use %tensorflow_version 1.x magic anymore.

It is possible to manually install tensorflow through pip, however doing just this I encountered errors due to the Cuda version.

I had to manually re-install the version of cuda and libcudnn:

!pip uninstall tensorflow
!pip install tensorflow-gpu==1.15
!apt install --allow-change-held-packages libcudnn7=7.4.1.5-1+cuda10.0

The most appropriate version of cuda and libcudnn to use with the tensorflow version you want to install can be found here.

The versions available of libcudnn can be found with the following command:

!apt list -a libcudnn7

This will list all libcudnn7 versions available.

I was having the same problems while trying to use StyleGAN2-ADA, which only supports TensorFlow 1.

I found out that unfortunately Google Colab removed support for TensorFlow 1 in their latest release of 2022/8/11.

'Removed support for TensorFlow 1'

You can find more information in their notebook Release-Notes: https://colab.research.google.com/notebooks/relnotes.ipynb

Related