我正在尝试在 Google Colab 中使用 BERT 并且
import tensorflow_hub as hub
但它引发了 ValueError:
The name 'tf.TrackableConstant' has already been registered to a serializable class. Found: <class 'tensorflow.python.eager.function_saved_model_utils.TrackableConstant'>
我相信这是版本冲突或类似的问题,但无法修复它。 我已经尝试过重新启动环境、安装不同版本的tensorflow和tensorflow_hub等,但没有成功。
2.9.2 也有同样的问题,但当我降级到 2.7 时工作正常
Tensorflow_hub
中复制相同内容时,
Google Colab
工作正常,没有显示任何错误。(请检查下图)。我还在 Google colab 中复制了这个 Classify text with BERT mdoel ,它按预期工作。
您能否再试一次,如果问题仍然存在,请告诉我们。