我对python和skflow很新,但我遇到了一个非常基本的问题,希望有人可以帮助我。
我已经安装了skflow并下载了示例中使用的dbpedia_csv。但是在运行' text_classification_character_rnn.py'例如,我遇到了错误:
MERGE
关于我做错的任何想法?此外,Traceback (most recent call last):
File "/home/me/Projects/skflow/examples/text_classification_character_rnn.py", line 70, in <module>
classifier.fit(X_train, y_train)
File "/home/me/Projects/skflow/skflow/estimators/base.py", line 217, in fit
self._setup_training()
File "/home/me/Projects/skflow/skflow/estimators/base.py", line 148, in _setup_training
self._inp, self._out)
File "/home/me/Projects/skflow/examples/text_classification_character_rnn.py", line 63, in char_rnn_model
return skflow.models.logistic_regression(encoding, y)
File "/home/me/Projects/skflow/skflow/models.py", line 65, in logistic_regression
tf.histogram_summary('logistic_regression.X', X)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/summary_ops.py", line 39, in histogram_summary
tag=tag, values=values, name=scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_summary_ops.py", line 34, in _histogram_summary
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/op_def_library.py", line 397, in apply_op
values, name=input_arg.name, dtype=dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 468, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/constant_op.py", line 143, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 287, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 227, in _AssertCompatible
(dtype.name, mismatch))
TypeError: Expected float32, got <tensorflow.python.framework.ops.Tensor object at 0x7f415dfcc290> instead.
正在运行,但text_classification_cnn.py
没有打印精度。我使用PyCharm Edu 2.0.3来运行代码。
答案 0 :(得分:2)
这看起来像skflow和TensorFlow之间的版本不匹配。从错误消息中,看起来您有TensorFlow的旧版本(0.5或0.6)。但是,skflow recently updated在TensorFlow中使用了一个新界面,看起来你正在使用这个最新版本的skflow。
最简单的解决方案是upgrade TensorFlow到版本0.7.1