Command line SyntaxNet demo not working: TypeError: __init__() takes at most 2 arguments (3 given)

150 Views Asked by At

I installed SyntaxNet on OS X El Capitan based on their documentation. I am using Python 2.7. When I run the demo, I get error that says TypeError: takes two arguments but 3 given. Any help is appreciated.

I am invoking the following command form SyntaxNet's working directory:

echo "This is test."|syntaxnet/demo.sh

The detail of the error message is shown below:

 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
1

There are 1 best solutions below

0
On

I met the similar error 'TypeError: init() takes at most 2 arguments (3 given)' when compiling on Ubuntu.

Before running your command below echo "This is test."|syntaxnet/demo.sh I would like to suggest you to run the following test command bazel test --linkopt=-headerpad_max_install_names \ syntaxnet/... util/utf8/...