我在OS X El Capitan上基于their documentation安装了SyntaxNet。我使用的是Python 2.7。当我运行演示时,我得到的错误是TypeError:接受两个参数但是给出了3个。任何帮助表示赞赏。
我正在调用以下命令格式SyntaxNet的工作目录:
echo "This is test."|syntaxnet/demo.sh
错误消息的详细信息如下所示:
Traceback (most recent call last):
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/parser_eval.py", line 161, in <module>
tf.app.run()
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/parser_eval.py", line 157, in main
Eval(sess)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/parser_eval.py", line 111, in Eval
evaluation_max_steps=FLAGS.max_steps)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/structured_graph_builder.py", line 236, in AddEvaluation
return_average=self._use_averaging)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/graph_builder.py", line 331, in _BuildNetwork
return_average=return_average))
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/graph_builder.py", line 298, in _AddEmbedding
return_average=return_average)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/graph_builder.py", line 254, in _AddParam
ema.average(param), tf.zeros_initializer)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/ops/state_ops.py", line 208, in init_variable
value = init(v.get_shape().as_list(), v.dtype.base_dtype)
TypeError: __init__() takes at most 2 arguments (3 given)
Traceback (most recent call last):
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/parser_eval.py", line 161, in <module>
tf.app.run()
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/platform/app.py", line 44, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/parser_eval.py", line 157, in main
Eval(sess)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/parser_eval.py", line 111, in Eval
evaluation_max_steps=FLAGS.max_steps)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/structured_graph_builder.py", line 236, in AddEvaluation
return_average=self._use_averaging)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/graph_builder.py", line 331, in _BuildNetwork
return_average=return_average))
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/graph_builder.py", line 298, in _AddEmbedding
return_average=return_average)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/__main__/syntaxnet/graph_builder.py", line 254, in _AddParam
ema.average(param), tf.zeros_initializer)
File "/Users/username/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/org_tensorflow/tensorflow/python/ops/state_ops.py", line 208, in init_variable
value = init(v.get_shape().as_list(), v.dtype.base_dtype)
TypeError: __init__() takes at most 2 arguments (3 given)
INFO:tensorflow:Read 0 documents
答案 0 :(得分:0)
我遇到了类似的错误&#39; TypeError: init ()最多需要2个参数(3个给定)&#39;在Ubuntu上编译时。
在下面运行命令之前 echo&#34;这是测试。&#34; | syntaxnet / demo.sh 我建议你运行以下测试命令 bazel test --linkopt = -headerpad_max_install_names \ syntaxnet / ... util / utf8 /...