如何在Colab中降级Tensorflow版本

如何在Colab中降级Tensorflow版本

本文介绍了如何在Colab中降级Tensorflow版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pip3 install tensorflow==1.8.0,但是它不支持GPU.

I am using pip3 install tensorflow==1.8.0, but it doesn't have GPU support.

所以我正在使用pip3 install tensorflow-gpu==1.8.0,但是它仍然会引发异常

So I am using pip3 install tensorflow-gpu==1.8.0, but it still raises an exception

我应该使用colab从源代码安装tensorflow吗?

Should I use colab to install tensorflow from source?

pip3 list之后:

tensorboard              1.10.0
tensorflow               1.10.0
tensorflow-hub           0.1.1

推荐答案

您可以将Tensorflow降级到以前的版本,而无需在Google Colab上提供GPU支持.我跑了:

You can downgrade Tensorflow to a previous version without GPU support on Google Colab. I ran:

!pip install tensorflow==1.12.0
import tensorflow as tf
print(tf.__version__)

最初返回的

2.0.0-dev20190130

但是当我在几个小时后返回时,得到了我要求的版本:

but when I returned to it after a few hours, I got the version I requested:

1.12.0

尝试降级到具有GPU支持的版本:

Trying to downgrade to a version with GPU support:

!pip install tensorflow-gpu==1.12.0

需要重新启动运行时并失败,因为导入import tensorflow as tf会返回:

requires restarting the runtime and fails, as importing import tensorflow as tf returns:


ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

更新

导入失败时,您始终可以使用以下命令将CUDA降级到9.0版

Update

When the import fails you can always downgrade CUDA to version 9.0 using following commands

!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
!apt-get update
!apt-get install cuda=9.0.176-1

您可以通过运行以下命令检查CUDA的版本:

You can check the version of CUDA by running:

!nvcc --version

第二次更新

此代码现在似乎失败了,请参见

这篇关于如何在Colab中降级Tensorflow版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 15:16