我经历了https://github.com/tensorflow/models/tree/master/syntaxnet并做了所有的事情。
我跑来测试:
bazel test --linkopt=-headerpad_max_install_names \
syntaxnet/... util/utf8/...
我只能进行6次测试,6次失败。
但是当我运行演示时,我收到了错误。
User:syntaxnet hk$ echo "Parsey McParseface is my favorite parser" | syntaxnet/demo.sh
Traceback (most recent call last):
File "/git/models/syntaxnet/bazel-bin/syntaxnet/conll2tree.runfiles/syntaxnet/conll2tree.py", line 20, in <module>
import tensorflow as tf
File "/git/models/syntaxnet/bazel-bin/syntaxnet/conll2tree.runfiles/external/tf/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/git/models/syntaxnet/bazel-bin/syntaxnet/conll2tree.runfiles/external/tf/tensorflow/python/__init__.py", line 45, in <module>
from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name pywrap_tensorflow
Traceback (most recent call last):
Traceback (most recent call last):
File "/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/syntaxnet/parser_eval.py", line 23, in <module>
File "/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/syntaxnet/parser_eval.py", line 23, in <module>
import tensorflow as tf
File "/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/external/tf/tensorflow/__init__.py", line 23, in <module>
import tensorflow as tf
File "/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/external/tf/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/external/tf/tensorflow/python/__init__.py", line 45, in <module>
from tensorflow.python import *
File "/git/models/syntaxnet/bazel-bin/syntaxnet/parser_eval.runfiles/external/tf/tensorflow/python/__init__.py", line 45, in <module>
from tensorflow.python import pywrap_tensorflow
ImportError: from tensorflow.python import pywrap_tensorflow
cannot import name pywrap_tensorflow
ImportError: cannot import name pywrap_tensorflow
发生了什么事? demo.sh是否在不同位置寻找那些python导入?
答案 0 :(得分:3)
解决。我错过了bazel安装中的一些步骤,特别是&#39;获得bash完成&#39;。我以为那只是为了 JDK7。
答案 1 :(得分:2)
尝试使用bazel命令再次构建和测试SyntaxNet。我遇到了一个非常类似的错误,其中bazel在我的机器上找不到python目录。经过几次查找python目录的尝试,bazel完成了构建并测试了SyntaxNet的1次失败测试(根据bazel的localhost错误),demo.sh工作正常。
我再次尝试构建和测试Syntaxnet,这次它通过了12次测试,这是好事。
INFO: Elapsed time: 88.935s, Critical Path: 31.63s
//syntaxnet:arc_standard_transitions_test (cached) PASSED in 3.5s
//syntaxnet:beam_reader_ops_test (cached) PASSED in 20.6s
//syntaxnet:graph_builder_test (cached) PASSED in 21.4s
//syntaxnet:lexicon_builder_test (cached) PASSED in 8.7s
//syntaxnet:parser_features_test (cached) PASSED in 0.7s
//syntaxnet:parser_trainer_test (cached) PASSED in 36.4s
//syntaxnet:reader_ops_test (cached) PASSED in 6.0s
//syntaxnet:sentence_features_test (cached) PASSED in 1.6s
//syntaxnet:tagger_transitions_test (cached) PASSED in 1.6s
//syntaxnet:text_formats_test (cached) PASSED in 8.7s
//util/utf8:unicodetext_unittest (cached) PASSED in 5.6s
//syntaxnet:shared_store_test PASSED in 6.0s
Executed 1 out of 12 tests: 12 tests pass.
还有来自bazel的额外提醒可能会有所帮助:
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
希望这会有所帮助。