无属性';启用渴望执行'?已经在使用TensorFlow 1.7

无属性';启用渴望执行'?已经在使用TensorFlow 1.7,tensorflow,google-colaboratory,Tensorflow,Google Colaboratory,根据TensorFlow程序指南(),以下操作需要TensorFlow 1.7,但我得到了一个错误(见下文) 这是我的设置 我是在googlecolab中按照本页的说明做这件事的() 然后 !mkdir -p drive !google-drive-ocamlfuse drive !pip install -q keras 然后再次使用 这应该升级到1.7,但随后出现以下错误: AttributeErrorTraceback (most recent call last) <ipyth

根据TensorFlow程序指南(),以下操作需要
TensorFlow 1.7
,但我得到了一个错误(见下文)

这是我的设置

我是在
googlecolab
中按照本页的说明做这件事的()

然后

!mkdir -p drive
!google-drive-ocamlfuse drive
!pip install -q keras
然后再次使用

这应该升级到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'
试过每晚的身材

print(tf.__version__)
1.6.0
!pip install tf-nightly
print(tf.__version__)
1.6.0

因此,我想我现在的问题是——如何在
Google Colab
中升级到1.7?

如果在运行
pip升级之前已经导入了TensorFlow,那么在更新之后您将需要重新启动内核。(运行时菜单->重新启动运行时)

从一个新启动的内核进程中,以下内容按照我的预期打印了1.7:

!pip install -q -U tensorflow>=1.7
import tensorflow
tensorflow.__version__
哦,我找到了答案——笔记本必须使用GPU硬件加速器(编辑->笔记本设置)

谢谢

更新


到目前为止,我不确定使用GPU硬件加速器是否真的是解决问题的方法。请参阅鲍勃·史密斯的另一个答案。我想笔记本可能有一些记忆状态,所以我不确定我的实验结果的结论。您可能想尝试这两种建议。

好消息——我们刚刚完成了TF 1.7的更新,因此默认情况下您应该可以使用它。:)

谢谢!我现在很困惑。因为在某一点上,我似乎必须使用GPU加速,但现在我也遵循了你的建议(设置非GPU),它也起了作用。所以我认为GPU加速可能不是必需的。
print(tf.__version__)
1.6.0
!pip install tf-nightly
print(tf.__version__)
1.6.0
!pip install -q -U tensorflow>=1.7
import tensorflow
tensorflow.__version__