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

时间:2016-12-16 07:04:04

标签: tensorflow pip anaconda python-3.5

我成功安装了Tensorflow并运行了convolutional.py示例。     但是,当我运行示例Wide and Deep net tutorial时,我收到以下错误

 % 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'

similar问题中提出的问题最多,有些人建议卸载protobuf并在安装tensorflow后安装它,但在我的情况下它没有帮助,如果有人可以提供帮助,我会非常感激。< / p>

1 个答案:

答案 0 :(得分:5)

TL; DR:确保运行与已安装的TensorFlow版本匹配的wide_n_deep_tutorial.py版本。例如,如果安装了TensorFlow 0.12,则可以下载version from the r0.12 branch

文件wide_n_deep_tutorial.py在TensorFlow的主分支中为recently changed,以反映API中的更改(在评论中为points out tf.SparseTensor.shapetf.SparseTensor.dense_shape正在变为{{ 1}}在 next 版本中。)