OS平台和发行版(例如, Linux Ubuntu 16.04):Ubuntu 18.04.3 从以下位置安装TensorFlow:pip TensorFlow版本:v2.1.0-rc2-17-ge5bf8de Python版本:anaconda的3.7.0 CUDA / cuDNN版本:10.1.243
保存模型的时间
saver = tf.compat.v1.train.Saver(tf.compat.v1.global_variables(), max_to_keep=3)
path = saver.save(sess, checkpoint_prefix, global_step=current_step)
print("Saved model checkpoint to {}".format(path))
发生错误:
[libprotobuf ERROR google/protobuf/wire_format_lite.cc:577] String field 'tensorflow.TensorShapeProto.Dim.name' contains invalid UTF-8 data when parsing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.
Traceback (most recent call last):
File "cnn.py", line 374, in <module>
train(args, x_train, y_train, vocab_size, x_dev, y_dev)
File "cnn.py", line 279, in train
path = saver.save(sess, checkpoint_prefix, global_step=current_step)
File "xxx/anaconda3/envs/li/lib/python3.7/site-packages/tensorflow_core/python/training/saver.py", line 1203, in save
save_debug_info=save_debug_info)
File "xxx/anaconda3/envs/li/lib/python3.7/site-packages/tensorflow_core/python/training/saver.py", line 1246, in export_meta_graph
graph_def=ops.get_default_graph().as_graph_def(add_shapes=True),
File "xxx/anaconda3/envs/li/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3134, in as_graph_def
result, _ = self._as_graph_def(from_version, add_shapes)
File "xxx/anaconda3/envs/li/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3051, in _as_graph_def
graph.ParseFromString(compat.as_bytes(data))
google.protobuf.message.DecodeError: Error parsing message