tensorflow - Colab 最近更新导致错误:Tensor 对象仅在启用 Eager Execution 时才可迭代
问题描述
我有一个受https://github.com/kyzhouhzau/BERT-NER启发的谷歌 Colab 笔记本,几个月前它运行得非常好。
现在它在在线训练期间失败了
estimator.train(input_fn=train_input_fn, max_steps=num_train_steps)
带有错误消息:
TypeError Traceback (most recent call last)
<ipython-input-106-a57b458e486b> in <module>()
54 is_training=True,
55 drop_remainder=True)
---> 56 estimator.train(input_fn=train_input_fn, max_steps=num_train_steps)
57
58 #evaluate
14 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in __iter__(self)
475 if not context.executing_eagerly():
476 raise TypeError(
--> 477 "Tensor objects are only iterable when eager execution is "
478 "enabled. To iterate over this tensor use tf.map_fn.")
479 shape = self._shape_tuple()
TypeError: Tensor objects are only iterable when eager execution is enabled. To iterate over this tensor use tf.map_fn.
我尝试添加: tf.enable_eager_execution()
强制执行急切但没有帮助
我在想图书馆的更新可能会导致这个问题。它曾经在 tensorflow 1.13.1 和 bert-tensorflow-1.0.1(来自 bert-tensorflow)(1.11.0)上工作。
现在它使用 tensorflow 1.14.0-rc1 和 bert-tensorflow-1.0.1(来自 bert-tensorflow)(1.12.0)。
任何有关如何解决此问题的建议将不胜感激!谢谢
解决方案
推荐阅读
- ethereum - Solidity - 我部署什么版本的合约?
- c++ - C++向量构造函数实现
- github - 审计日志导出和聚合
- terraform - 使用 Terraform 在 Linux VM 上运行脚本扩展
- amazon-web-services - 部署 EKS 的 CDK 代码更新时 AssetParameters 发生变化
- node.js - 无法连接到 socket.io 服务器
- java-8 - 即使数据库实例关闭,CrudRepository 计数方法也会返回结果
- esp32 - 带有 esp32 的 Enc28j60 模块挂起
- curl - cURL NTLM 对 IIS8.5 的授权失败
- c# - 有没有办法在 bunit 测试中设置 OnAfterRender 方法的 firstRender-Variable?