0

我正在尝试按照syntaxnet 的 github 页面上的说明来构建 syntaxnet 解析器模型。

我的系统是 Debian Wheezy。与 Ubuntu 14.04 LTS 或 15.05 应该没有太大区别。我已经从源代码编译了 bazel 0.2.2(而不是 0.2.2b),它似乎可以正常工作。

每当我启动bazel test syntaxnet/... util/utf8/...命令时,都不会执行任何测试(全部跳过),并带有一些非常神秘的错误消息。这是一个例子:

root@host:~/tensorflow_syntaxnet/models/syntaxnet# ../../bazel/output/bazel test syntaxnet/... util/utf8/...
Extracting Bazel installation...
.............
INFO: Found 65 targets and 12 test targets...
ERROR: /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/external/six_archive/BUILD:1:1: Executing genrule @six_archive//:copy_six failed: namespace-sandbox failed: error executing command /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox ... (remaining 5 argument(s) skipped).
unshare failed with EINVAL even after 101 tries, giving up.
INFO: Elapsed time: 95.469s, Critical Path: 22.46s
//syntaxnet:arc_standard_transitions_test                             NO STATUS
//syntaxnet:beam_reader_ops_test                                      NO STATUS
//syntaxnet:graph_builder_test                                        NO STATUS
//syntaxnet:lexicon_builder_test                                      NO STATUS
//syntaxnet:parser_features_test                                      NO STATUS
//syntaxnet:parser_trainer_test                                       NO STATUS
//syntaxnet:reader_ops_test                                           NO STATUS
//syntaxnet:sentence_features_test                                    NO STATUS
//syntaxnet:shared_store_test                                         NO STATUS
//syntaxnet:tagger_transitions_test                                   NO STATUS
//syntaxnet:text_formats_test                                         NO STATUS
//util/utf8:unicodetext_unittest                                      NO STATUS

Executed 0 out of 12 tests: 12 were skipped.

我按照推荐使用 Oracle Java 8 JDK,我的编译器是:

~/tensorflow_syntaxnet/models/syntaxnet# gcc --version
gcc (Debian 4.7.2-5) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

尝试查看namespace-sandbox错误消息中提到的二进制文件,但在我深入研究之前,我想我会在这里问。

~/tensorflow_syntaxnet/models/syntaxnet# ls -l /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
lrwxrwxrwx 1 root root 108 May 13 14:52 /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox -> /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
~/tensorflow_syntaxnet/models/syntaxnet# readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox

命令似乎工作正常:

~/tensorflow_syntaxnet/models/syntaxnet# file $(readlink /root/.cache/bazel/_bazel_root/74c6bab7a21f28ad02405b720243d086/syntaxnet/_bin/namespace-sandbox)
/root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[md5/uuid]=0xecfd97b6a6b9a193b045be13654bd55b, not stripped
~/tensorflow_syntaxnet/models/syntaxnet# /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
No command specified.
Usage: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox [-S sandbox-root] -- command arg1
  provided: /root/.cache/bazel/_bazel_root/install/ca381eaad1c931167a6355cb8a2b98cf/_embedded_binaries/namespace-sandbox
Mandatory arguments:
  -S <sandbox-root>  directory which will become the root of the sandbox
  --  command to run inside sandbox, followed by arguments

Optional arguments:
  -W <working-dir>  working directory
  -T <timeout>  timeout after which the child process will be terminated with SIGTERM
  -t <timeout>  in case timeout occurs, how long to wait before killing the child with SIGKILL
  -d <dir>  create an empty directory in the sandbox
  -M/-m <source/target>  system directory to mount inside the sandbox
    Multiple directories can be specified and each of them will be mounted readonly.
    The -M option specifies which directory to mount, the -m option specifies where to
    mount it in the sandbox.
  -n if set, a new network namespace will be created
  -r if set, make the uid/gid be root, otherwise use nobody
  -D  if set, debug info will be printed
  -l <file>  redirect stdout to a file
  -L <file>  redirect stderr to a file
  @FILE read newline-separated arguments from FILE

任何想法?

更新:我在 Ubuntu 14.04 LTS(我的小型工作站,而不是运行 Debian 的生产服务器)上完成了完全相同的步骤,并且一切正常,所有测试都通过了。我想知道有什么区别。

4

1 回答 1

1

显然,在设置沙箱时会发生一些权限错误。一种快速的解决方法是通过使用来停用沙箱--genrule_strategy=standalone --spawn_strategy=standalone(请注意,第二个已在 TensorFlow rc 文件中指定)。

您可以在 ~/.bazelrc 中设置这些标志: echo "build --genrule_strategy=standalone --spawn_strategy=standalone" >>~/.bazelrc

于 2016-05-17T07:27:01.107 回答