Tensorflow无法运行广泛而深入的网络教程

Eli*_*yan 2 pip anaconda python-3.5 tensorflow

我成功安装了Tensorflow并运行了convolutional.py示例.但是,当我运行示例Wide和Deep网络教程时,我收到以下错误

 % python wide_deep_tutorial.py                                                                                                                 
   Training data is downloaded to /tmp/tmpr3k3fwnc
   Test data is downloaded to /tmp/tmpzxhrdh00
   model directory = /tmp/tmpg_s1yutm
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "sum" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:The default value of combiner will change from "mean" to "sqrtn" after 2016/11/01.
   WARNING:tensorflow:From    /home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py:711 in fit.: calling BaseEstimator.fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with x is deprecated and will be removed after 2016-12-01.
    Instructions for updating:
    Estimator is decoupled from Scikit Learn interface by moving into
    separate class SKCompat. Arguments x, y and batch_size are only
    available in the SKCompat class, Estimator will only accept input_fn.
    Example conversion:
      est = Estimator(...) -> est = SKCompat(Estimator(...))
    WARNING:tensorflow:From /home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py:711 in fit.: calling BaseEstimator.fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with y is deprecated and will be removed after 2016-12-01.
    Instructions for updating:
    Estimator is decoupled from Scikit Learn interface by moving into
    separate class SKCompat. Arguments x, y and batch_size are only
    available in the SKCompat class, Estimator will only accept input_fn.
    Example conversion:
      est = Estimator(...) -> est = SKCompat(Estimator(...))
    WARNING:tensorflow:From /home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py:711 in fit.: calling BaseEstimator.fit (from tensorflow.contrib.learn.python.learn.estimators.estimator) with batch_size is deprecated and will be removed after 2016-12-01.
    Instructions for updating:
    Estimator is decoupled from Scikit Learn interface by moving into
    separate class SKCompat. Arguments x, y and batch_size are only
    available in the SKCompat class, Estimator will only accept input_fn.
    Example conversion:
      est = Estimator(...) -> est = SKCompat(Estimator(...))
    Traceback (most recent call last):
      File "wide_deep_tutorial.py", line 208, in <module>
        tf.app.run()
      File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 43, in run
        sys.exit(main(sys.argv[:1] + flags_passthrough))
      File "wide_deep_tutorial.py", line 204, in main
        train_and_eval()
      File "wide_deep_tutorial.py", line 197, in train_and_eval
        m.fit(input_fn=lambda: input_fn(df_train), steps=FLAGS.train_steps)
      File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 711, in fit
        max_steps=max_steps)
      File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 191, in new_func
        return func(*args, **kwargs)
      File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 355, in fit
        max_steps=max_steps)
      File "/home/eliethesaiyan/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 690, in _train_model
        features, labels = input_fn()
      File "wide_deep_tutorial.py", line 197, in <lambda>
        m.fit(input_fn=lambda: input_fn(df_train), steps=FLAGS.train_steps)
      File "wide_deep_tutorial.py", line 159, in input_fn
        for k in CATEGORICAL_COLUMNS}
      File "wide_deep_tutorial.py", line 159, in <dictcomp>
        for k in CATEGORICAL_COLUMNS}
    TypeError: __init__() got an unexpected keyword argument 'dense_shape'
Run Code Online (Sandbox Code Playgroud)

在一个类似的问题中提出的问题最多,一些建议卸载protobuf并在安装tensorflow后安装它,但它在我的情况下没有帮助,如果有人可以提供帮助我会很感激.

mrr*_*rry 5

TL; DR:确保运行wide_n_deep_tutorial.py与安装的TensorFlow版本匹配的版本.例如,如果安装了TensorFlow 0.12 ,则可以r0.12分支下载该版本.

该文件wide_n_deep_tutorial.py最近改变了在TensorFlow的主分支,以反映API中的变化(如kempy 指出,在他们的评论,tf.SparseTensor.shape正成为tf.SparseTensor.dense_shape下一版本).