微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

tensorflow线性或增强树训练失败并显示“错误解析消息”

如何解决tensorflow线性或增强树训练失败并显示“错误解析消息”

我正在尝试通过TF 2.0运行一个示例,该示例与以下示例基本相同:https://www.tensorflow.org/tutorials/estimator/boosted_trees,除了以下事实:

  1. 我的数组更大,为63319行x 7330列,而不是627行和9列
  2. 我没有分类列,只有数字列
  3. 我的许多列名都相当长(可能是50个字符,而不是那个长!)

在该示例中,数据来自pandas数据框,具有int标签,等等。我的数据中没有nan或inf。

如果我尝试在数据上训练线性分类器或增强树分类器,最终我会得到

google.protobuf.message.DecodeError: Error parsing message

最后提到的文件

File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py",line 3211,in _as_graph_def
    graph.ParseFromString(compat.as_bytes(data))

有什么想法吗?我在Ubuntu 18.04和MacOS 10.15.6上都看到了相同的行为。 Ubuntu是Python 3.6.9,TF 2.3.0,protobuf 3.13.0。 Mac是Python 3.8.3,TF 2.3.0,protobuf 3.12.3

我可以采取一些措施来跟踪这种情况,例如逐渐缩小数据集直到错误消失,更改列标题等,但是它们都比较痛苦,似乎不太可能产生有用的信息。

非常感谢!

完全追溯错误(格式有些令人不愉快;我希望可以):

File "<stdin>",line 1,in <module>  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py",line 349,in train  
    loss = self._train_model(input_fn,hooks,saving_listeners)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py",line 1175,in _train_model  
    return self._train_model_default(input_fn,line 1208,in _train_model_default  
    saving_listeners)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py",line 1507,in _train_with_estimator_spec  
    log_step_count_steps=log_step_count_steps) as mon_sess:  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/training/monitored_session.py",line 604,in MonitoredTrainingSession  
    stop_grace_period_secs=stop_grace_period_secs)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/training/monitored_session.py",line 1038,in __init__  
    stop_grace_period_secs=stop_grace_period_secs)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/training/monitored_session.py",line 737,in __init__  
    h.begin()  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/training/basic_session_run_hooks.py",line 563,in begin  
    self._summary_writer = SummaryWriterCache.get(self._checkpoint_dir)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/summary/writer/writer_cache.py",line 63,in get  
    logdir,graph=ops.get_default_graph())  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/summary/writer/writer.py",line 371,in __init__  
    super(FileWriter,self).__init__(event_writer,graph,graph_def)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/summary/writer/writer.py",line 84,in __init__  
    self.add_graph(graph=graph,graph_def=graph_def)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/summary/writer/writer.py",line 194,in add_graph  
    true_graph_def = graph.as_graph_def(add_shapes=True)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py",line 3294,in as_graph_def  
    result,_ = self._as_graph_def(from_version,add_shapes)  
  File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py",in _as_graph_def  
    graph.ParseFromString(compat.as_bytes(data))  
google.protobuf.message.DecodeError: Error parsing message

和产生错误代码只是est.train(train_input_fn,max_steps = 100),就像在示例中一样(train_input_fn也是示例的副本)。数组大小如上所述; X是63319 x 7330,Y是63319 x 1。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。