【发布时间】:2018-04-11 18:58:53
【问题描述】:
根据 TensorFlow Program's Guide (here),以下操作需要TensorFlow 1.7,但出现错误(见下文)。
from __future__ import absolute_import, division, print_function
import tensorflow as tf
tf.enable_eager_execution()
这是我的设置。
我在 Google Colab 中按照此页面 (link) 上的说明执行此操作
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
然后
!mkdir -p drive
!google-drive-ocamlfuse drive
然后
!pip install -q keras
然后再次使用来自TensorFlow Programmer's Guide的指令
pip install --upgrade tensorflow
应该已经升级到 1.7,但是我得到了以下错误:
AttributeErrorTraceback (most recent call last)
<ipython-input-9-e1c25fd4f69c> in <module>()
1 from __future__ import absolute_import, division, print_function
2 import tensorflow as tf
----> 3 tf.enable_eager_execution()
AttributeError: 'module' object has no attribute 'enable_eager_execution'
有什么建议吗?
更新
我刚刚发现我仍然在TensorFlow 1.6 -- 即使在我尝试了夜间构建之后
print(tf.__version__)
1.6.0
尝试了夜间构建
!pip install tf-nightly
print(tf.__version__)
1.6.0
所以我想我现在的问题是——如何在Google Colab 中升级到 1.7?
【问题讨论】:
标签: tensorflow google-colaboratory