Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tensorflow线性或增强树训练失败;分析消息时出错";_Python_Tensorflow_Parsing_Classification - Fatal编程技术网

Python tensorflow线性或增强树训练失败;分析消息时出错";

Python tensorflow线性或增强树训练失败;分析消息时出错";,python,tensorflow,parsing,classification,Python,Tensorflow,Parsing,Classification,我试图通过TF 2.0运行一个与这里的示例基本相同的示例:除了以下事实: 我的数组更大,63319行x 7330列,而不是627行和9列 我没有分类列,只有数字列 我的许多列名都相当长(可能是50个字符,不是那么长!) 如示例中所示,数据来自pandas数据帧,具有int标签等。我的数据中没有nan或inf 如果我尝试在数据上训练线性分类器或增强树分类器,我最终会得到 google.protobuf.message.DecodeError: Error parsing message 最后提到

我试图通过TF 2.0运行一个与这里的示例基本相同的示例:除了以下事实:

  • 我的数组更大,63319行x 7330列,而不是627行和9列
  • 我没有分类列,只有数字列
  • 我的许多列名都相当长(可能是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、TF2.3.0和protobuf 3.13.0。Mac是Python 3.8.3、TF2.3.0和protobuf 3.12.3

    我可以做一些事情来追踪这一点,比如逐渐缩小数据集直到错误消失,更改列标题,等等,但这些都是中度痛苦的,似乎不太可能产生有用的信息

    非常感谢

    错误的完整回溯(格式有点令人不快;我希望可以):

    文件“”,第1行,在
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow_estimator/python/estimator/estimator.py”,第349行,列车中
    损失=自我训练模型(输入、挂钩、保存侦听器)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow_estimator/python/estimator/estimator.py”,第1175行,列车模型
    返回self.\u train\u model\u default(输入\u fn、挂钩、保存\u侦听器)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow\u estimator/python/estimator/estimator.py”,第1208行,默认模式
    保存(侦听器)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow\u estimator/python/estimator/estimator.py”,第1507行,带\u estimator\u规范
    log_step_count_steps=log_step_count_steps)作为mon sess:
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/training/monitored_session.py”,第604行,在MonitoredTrainingSession中
    停止\宽限期\秒=停止\宽限期\秒)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/training/monitored_session.py”,第1038行,在
    停止\宽限期\秒=停止\宽限期\秒)
    文件“/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow/python/training/monitored\u session.py”,第737行,在
    h、 开始
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/training/basic_session_run_hooks.py”,第563行,在begin中
    self.\u summary\u writer=SummaryWriterCache.get(self.\u checkpoint\u dir)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/summary/writer/writer_cache.py”,get中的第63行
    logdir,graph=ops.get\u default\u graph())
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/summary/writer/writer.py”,第371行,在
    超级(文件编写器,自身)。\uuuu初始化(事件编写器,图形,图形定义)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/summary/writer/writer.py”,第84行,在
    self.add_graph(graph=graph,graph_def=graph_def)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/summary/writer/writer.py”,第194行,在添加图中
    true\u graph\u def=graph.as\u graph\u def(add\u shapes=true)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/framework/ops.py”,第3294行,如图所示
    结果,u=self._作为_图形_定义(从_版本,添加_形状)
    文件“/home/ginsberg/.local/lib/python3.6/site packages/tensorflow/python/framework/ops.py”,第3211行,如图所示
    graph.ParseFromString(compat.as_字节(数据))
    google.protobuf.message.DecodeError:解析消息时出错
    

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

    您可以添加完整的错误回溯、尝试过的代码以及X和Y的形状吗?虽然很难看,但已完成。就像在示例页面上一样,真的。完整跟踪很难看,但可能会有帮助。我也用随机输入运行过它,用浮点数得到了相同的崩溃,但它对int有效!碰撞发生在图形构建过程中;有问题的机器上有足够的内存,而且GPU在图形生成之前不会被使用,所以这不是问题。代码仍在我这边运行。我发布的代码使用的是float32数据类型。您发布的代码有x=。。。dtype=np.int16,因此x值是介于0和99之间(包括0和99)的随机整数。这对我很有用。如果x值是浮动的,那么它就不起作用了。你能添加错误的完整回溯吗?试过的代码以及x和Y的形状?虽然很难看,但已经完成了。就像在示例页面上一样,真的。完整跟踪很难看,但可能会有帮助。我也用随机输入运行过它,用浮点数得到了相同的崩溃,但它对int有效!碰撞发生在图形构建过程中;有问题的机器上有足够的内存,而且GPU在图形生成之前不会被使用,所以这不是问题。代码仍在我这边运行。我发布的代码使用的是float32数据类型。您发布的代码有x=。。。dtype=np.int16,因此x值是介于0和99之间(包括0和99)的随机整数。这对我很有用。如果x值是浮动的,则它不起作用。
    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, hooks, saving_listeners)  
      File "/home/ginsberg/.local/lib/python3.6/site-packages/tensorflow_estimator/python/estimator/estimator.py", 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", line 3211, in _as_graph_def  
        graph.ParseFromString(compat.as_bytes(data))  
    google.protobuf.message.DecodeError: Error parsing message