python - 如何在google colaboratory上用GPU升级tensorflow

标签 python tensorflow google-colaboratory

目前 google colaboratory 使用 tensorflow 1.4.1。我想将它升级到 1.5.0 版本。每次执行 !pip install --upgrade tensorflow 命令时,notebook 实例都会成功将 tensorflow 版本升级到 1.5.0。但是升级后tensorflow实例只支持“CPU”。

当我执行此命令时,它什么也没显示:

从 tensorflow.python.client 导入 device_lib device_lib.list_local_devices()

是否应该有另一种升级 tensorflow 的方法?比如升级到 tensorflow-gpu 包?另外,笔记本什么时候会配备升级的 tensorflow?

最佳答案

截至 2020 年,Colab 可以运行 Tensorflow 2.0。卸载当前版本的 Tensorflow:

!pip uninstall tensorflow

然后只需使用 pip 重新安装即可。

!pip install tensorflow==2.0.0

如果您愿意,您也可以安装测试版

!pip install tensorflow==2.0.0-beta1

重新安装 Tensorflow 后,确保不要忘记在“运行时”选项卡下重新启动运行时。

native 解决方案是使用

开始您的代码
%tensorflow_version 2.x

关于python - 如何在google colaboratory上用GPU升级tensorflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48731124/

相关文章:

python - 散点图颜色条 - Matplotlib

python - 如何发送给多个收件人

python - 在 Google Colab 上运行 autokeras 图像分类器教程时出错

python - GPU 在 Google Colaboratory 上的 Pytorch 性能比 CPU 慢

python - 训练 CNN 后准确率较低

python - 如何在 Google Colaboratory 中导入 sagemath?

python - 无法从 pytest.fixture 获取数据,而是获取数据位置

python - 从字符串列表中,如何获得 python 中最奇怪的单词/字符串

python-3.x - 'num_samples' 在 Tune of Ray 包中用于超参数优化的目的

tensorflow - tensorflow 模型的设计模式