Pycharm+Bert代码调试过程错误集合

1.tensorflow版本问题

如果用的是TensorFlow2.0以上的版本,但代码需要的是TensorFlow1.0的版本,又不想改代码,可以把

import tensorflow as tf

改为

import tensorflow.compat.v1 as tf

2.AttributeError: module 'tensorflow' has no attribute 'gfile'

原代码

tf.gfile.GFile(vocab_file)

改为

tf.io.gfile.GFile(vocab_file)

3.UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 60: invalid continuation byte

更新中。。。

猜你喜欢

转载自blog.csdn.net/qq_42691604/article/details/129062927