我有一个受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)。
任何有关如何解决此问题的建议将不胜感激!谢谢