Errors when running the server script
sofo23 opened this issue · comments
I found errors when building "parsey_api" for the server here:
bazel --output_user_root=bazel_root build --nocheck_visibility -c opt -s //tensorflow_serving/example:parsey_api --genrule_strategy=standalone --spawn_strategy=standalone --verbose_failures
Extracting Bazel installation...
........
ERROR: Failed to load Skylark extension '//tensorflow/tensorflow:workspace.bzl'.
It usually happens when the repository is not defined prior to being used.
Maybe repository '' was defined later in your WORKSPACE file?
ERROR: cycles detected during target parsing.
INFO: Elapsed time: 2.306s
./batch.sh: line 52: ./bazel-bin/tensorflow_serving/example/parsey_api: No such file or directory
I am using:
Ubuntu 14.04
Bazel 0.4.4
python gPRC installed
Should I install the C++ version of gRPC?
Thank you.
Unfortunately, I have encountered the same issue, however with bazel 0.4.3 and gRPC properly installed.
Among other things like change to bazel 0.4.3, checkout proper version of serving (already done through this tutorial) I have also found "this is more related on how bazel works. the error is telling you that is trying to find the bazel file in the subidrectory //tensorflow/tensorflow:workspace.bzl so you need copy that file and change many things... it is easier to add your directory to the tensorflow workspace"
http://stackoverflow.com/questions/37083143/error-building-project-using-tensorflow
this problem is due to bazel
version.
i made an update on https://github.com/dsindex/syntaxnet/blob/master/README_api.md
# build parsey_api
$ cd serving
# bazel version 0.3.2
$ bazel --output_user_root=bazel_root build --nocheck_visibility -c opt -s //tensorflow_serving/example:parsey_api --genrule_strategy=standalone --spawn_strategy=standalone --verbose_failures
# if you have a trouble on downloading zlib ( https://github.com/tensorflow/tensorflow/issues/6668 )
# modify bellow files :
# ./tf_models/syntaxnet/WORKSPACE
# ./tensorflow/tensorflow/workspace.bzl
# ./tf_models/syntaxnet/tensorflow/tensorflow/workspace.bzl
# see : https://github.com/tensorflow/tensorflow/issues/6594
# for example)
# native.new_http_archive(
# name = "zlib_archive",
# url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
# sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
# strip_prefix = "zlib-1.2.8",
# build_file = str(Label("//third_party:zlib.BUILD")),
# )
#
to install bazel 0.3.2, i recommend you to use --prefix
option
$ ./bazel-0.3.2-installer-darwin-x86_64.sh --prefix=/some/path/bazel-0.3.2
$ vi ~/.bash_profile
# bazel
export PATH=${PATH}:${HOME}/bin
source ${HOME}/.bazelrc
# bazel 0.3.2
BAZEL_OLD_HOME="/some/path/bazel-0.3.2/lib/bazel"
export PATH=${BAZEL_OLD_HOME}/bin:${PATH}
source ${BAZEL_OLD_HOME}/bin/bazel-complete.bash
I have still some errors. It is likely the zlib. I have tried bazel 0.3.2 and 0.2.2b. I have added the instruction for zlib but it seems not working. I got this error:
ERROR:/work/serving/tensorflow_serving/workspace.bzl:33:3: no such package '@zlib_archive//': Unable to load package for //third_party:zlib.BUILD: not found. and referenced by '//external:zlib'.
ERROR: Analysis of target '//tensorflow_serving/example:parsey_api' failed; build aborted.
INFO: Elapsed time: 143.909s
Here are the files:
# ./tf_models/syntaxnet/WORKSPACE
# ./tensorflow/tensorflow/workspace.bzl
# ./tf_models/syntaxnet/tensorflow/tensorflow/workspace.bz
./tf_models/syntaxnet/WORKSPACE
local_repository(
name = "org_tensorflow",
path = __workspace_dir__ + "/tensorflow",
)
load('//tensorflow/tensorflow:workspace.bzl', 'tf_workspace')
tf_workspace("tensorflow/", "@org_tensorflow")
# Specify the minimum required Bazel version.
load("@org_tensorflow//tensorflow:tensorflow.bzl", "check_version")
check_version("0.2.0")
# ===== gRPC dependencies =====
bind(
name = "libssl",
actual = "@ts_boringssl_git//:ssl",
)
git_repository(
name = "ts_boringssl_git",
commit = "436432d849b83ab90f18773e4ae1c7a8f148f48d",
init_submodules = True,
remote = "https://github.com/mdsteele/boringssl-bazel.git",
)
native.new_http_archive(
name = "zlib_archive",
url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
strip_prefix = "zlib-1.2.8",
build_file = str(Label("//third_party:zlib.BUILD")),
)
./tensorflow/tensorflow/workspace.bzl
# TensorFlow external dependencies that can be loaded in WORKSPACE files.
# If TensorFlow is linked as a submodule, path_prefix is TensorFlow's directory
# within the workspace (e.g. "tensorflow/"), and tf_repo_name is the name of the
# local_repository rule (e.g. "@tf").
def tf_workspace(path_prefix = "", tf_repo_name = ""):
native.new_http_archive(
name = "eigen_archive",
url = "https://bitbucket.org/eigen/eigen/get/802d984ade26.tar.gz",
sha256 = "1499997676bd9006082950a761b88d5c48554fd550747763b2b34951da29a2e8",
build_file = path_prefix + "eigen.BUILD",
)
native.git_repository(
name = "re2",
remote = "https://github.com/google/re2.git",
commit = "791beff",
)
native.git_repository(
name = "gemmlowp",
remote = "https://github.com/google/gemmlowp.git",
commit = "96d3acab46fbb03855ca22c2ee2bb9831ac8c83c",
)
native.new_http_archive(
name = "farmhash_archive",
url = "https://github.com/google/farmhash/archive/34c13ddfab0e35422f4c3979f360635a8c050260.zip",
sha256 = "e3d37a59101f38fd58fb799ed404d630f0eee18bfc2a2433910977cc8fea9c28",
build_file = path_prefix + "farmhash.BUILD",
)
native.bind(
name = "farmhash",
actual = "@farmhash//:farmhash",
)
native.git_repository(
name = "highwayhash",
remote = "https://github.com/google/highwayhash.git",
commit = "be5edafc2e1a455768e260ccd68ae7317b6690ee",
init_submodules = True,
)
native.new_http_archive(
name = "jpeg_archive",
url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz",
sha256 = "3a753ea48d917945dd54a2d97de388aa06ca2eb1066cbfdc6652036349fe05a7",
build_file = path_prefix + "jpeg.BUILD",
)
native.new_http_archive(
name = "png_archive",
url = "https://github.com/glennrp/libpng/archive/v1.2.53.zip",
sha256 = "c35bcc6387495ee6e757507a68ba036d38ad05b415c2553b3debe2a57647a692",
build_file = path_prefix + "png.BUILD",
)
native.new_http_archive(
name = "six_archive",
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
build_file = path_prefix + "six.BUILD",
)
native.bind(
name = "six",
actual = "@six_archive//:six",
)
native.git_repository(
name = "protobuf",
remote = "https://github.com/google/protobuf",
commit = "ed87c1fe2c6e1633cadb62cf54b2723b2b25c280",
)
native.new_http_archive(
name = "gmock_archive",
url = "https://archive.openswitch.net/gmock-1.7.0.zip",
sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b",
build_file = path_prefix + "gmock.BUILD",
)
native.bind(
name = "gtest",
actual = "@gmock_archive//:gtest",
)
native.bind(
name = "gtest_main",
actual = "@gmock_archive//:gtest_main",
)
native.bind(
name = "python_headers",
actual = tf_repo_name + "//util/python:python_headers",
)
# grpc expects //external:protobuf_clib and //external:protobuf_compiler
# to point to the protobuf's compiler library.
native.bind(
name = "protobuf_clib",
actual = "@protobuf//:protoc_lib",
)
native.bind(
name = "protobuf_compiler",
actual = "@protobuf//:protoc_lib",
)
native.new_git_repository(
name = "grpc",
commit = "39650266",
init_submodules = True,
remote = "https://github.com/grpc/grpc.git",
build_file = path_prefix + "grpc.BUILD",
)
# protobuf expects //external:grpc_cpp_plugin to point to grpc's
# C++ plugin code generator.
native.bind(
name = "grpc_cpp_plugin",
actual = "@grpc//:grpc_cpp_plugin",
)
native.bind(
name = "grpc_lib",
actual = "@grpc//:grpc++_unsecure",
)
native.new_git_repository(
name = "jsoncpp_git",
remote = "https://github.com/open-source-parsers/jsoncpp.git",
commit = "11086dd6a7eba04289944367ca82cea71299ed70",
build_file = path_prefix + "jsoncpp.BUILD",
)
native.bind(
name = "jsoncpp",
actual = "@jsoncpp_git//:jsoncpp",
)
native.new_git_repository(
name = "boringssl_git",
commit = "e72df93461c6d9d2b5698f10e16d3ab82f5adde3",
remote = "https://boringssl.googlesource.com/boringssl",
build_file = path_prefix + "boringssl.BUILD",
)
native.bind(
name = "boringssl_err_data_c",
actual = "@//" + path_prefix + "third_party/boringssl:err_data_c",
)
native.new_git_repository(
name = "nanopb_git",
commit = "1251fa1",
remote = "https://github.com/nanopb/nanopb.git",
build_file = path_prefix + "nanopb.BUILD",
)
native.bind(
name = "nanopb",
actual = "@nanopb_git//:nanopb",
)
native.new_http_archive(
name = "avro_archive",
url = "http://www-us.apache.org/dist/avro/avro-1.8.0/cpp/avro-cpp-1.8.0.tar.gz",
sha256 = "ec6e2ec957e95ca07f70cc25f02f5c416f47cb27bd987a6ec770dcbe72527368",
build_file = path_prefix + "avro.BUILD",
)
native.new_http_archive(
name = "boost_archive",
url = "http://pilotfiber.dl.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.tar.gz",
sha256 = "a77c7cc660ec02704c6884fbb20c552d52d60a18f26573c9cee0788bf00ed7e6",
build_file = path_prefix + "boost.BUILD",
)
native.new_http_archive(
name = "bzip2_archive",
url = "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz",
sha256 = "a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd",
build_file = path_prefix + "bzip2.BUILD",
)
native.new_http_archive(
name = "zlib_archive",
url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
strip_prefix = "zlib-1.2.8",
build_file = str(Label("//third_party:zlib.BUILD")),
)
./tf_models/syntaxnet/tensorflow/tensorflow/workspace.bzl
# TensorFlow external dependencies that can be loaded in WORKSPACE files.
# If TensorFlow is linked as a submodule, path_prefix is TensorFlow's directory
# within the workspace (e.g. "tensorflow/"), and tf_repo_name is the name of the
# local_repository rule (e.g. "@tf").
def tf_workspace(path_prefix = "", tf_repo_name = ""):
native.new_http_archive(
name = "eigen_archive",
url = "https://bitbucket.org/eigen/eigen/get/802d984ade26.tar.gz",
sha256 = "1499997676bd9006082950a761b88d5c48554fd550747763b2b34951da29a2e8",
build_file = path_prefix + "eigen.BUILD",
)
native.git_repository(
name = "re2",
remote = "https://github.com/google/re2.git",
commit = "791beff",
)
native.git_repository(
name = "gemmlowp",
remote = "https://github.com/google/gemmlowp.git",
commit = "96d3acab46fbb03855ca22c2ee2bb9831ac8c83c",
)
native.new_http_archive(
name = "farmhash_archive",
url = "https://github.com/google/farmhash/archive/34c13ddfab0e35422f4c3979f360635a8c050260.zip",
sha256 = "e3d37a59101f38fd58fb799ed404d630f0eee18bfc2a2433910977cc8fea9c28",
build_file = path_prefix + "farmhash.BUILD",
)
native.bind(
name = "farmhash",
actual = "@farmhash//:farmhash",
)
native.git_repository(
name = "highwayhash",
remote = "https://github.com/google/highwayhash.git",
commit = "be5edafc2e1a455768e260ccd68ae7317b6690ee",
init_submodules = True,
)
native.new_http_archive(
name = "jpeg_archive",
url = "http://www.ijg.org/files/jpegsrc.v9a.tar.gz",
sha256 = "3a753ea48d917945dd54a2d97de388aa06ca2eb1066cbfdc6652036349fe05a7",
build_file = path_prefix + "jpeg.BUILD",
)
native.new_http_archive(
name = "png_archive",
url = "https://github.com/glennrp/libpng/archive/v1.2.53.zip",
sha256 = "c35bcc6387495ee6e757507a68ba036d38ad05b415c2553b3debe2a57647a692",
build_file = path_prefix + "png.BUILD",
)
native.new_http_archive(
name = "six_archive",
url = "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
build_file = path_prefix + "six.BUILD",
)
native.bind(
name = "six",
actual = "@six_archive//:six",
)
native.git_repository(
name = "protobuf",
remote = "https://github.com/google/protobuf",
commit = "ed87c1fe2c6e1633cadb62cf54b2723b2b25c280",
)
native.new_http_archive(
name = "gmock_archive",
url = "https://archive.openswitch.net/gmock-1.7.0.zip",
sha256 = "26fcbb5925b74ad5fc8c26b0495dfc96353f4d553492eb97e85a8a6d2f43095b",
build_file = path_prefix + "gmock.BUILD",
)
native.bind(
name = "gtest",
actual = "@gmock_archive//:gtest",
)
native.bind(
name = "gtest_main",
actual = "@gmock_archive//:gtest_main",
)
native.bind(
name = "python_headers",
actual = tf_repo_name + "//util/python:python_headers",
)
# grpc expects //external:protobuf_clib and //external:protobuf_compiler
# to point to the protobuf's compiler library.
native.bind(
name = "protobuf_clib",
actual = "@protobuf//:protoc_lib",
)
native.bind(
name = "protobuf_compiler",
actual = "@protobuf//:protoc_lib",
)
native.new_git_repository(
name = "grpc",
commit = "39650266",
init_submodules = True,
remote = "https://github.com/grpc/grpc.git",
build_file = path_prefix + "grpc.BUILD",
)
# protobuf expects //external:grpc_cpp_plugin to point to grpc's
# C++ plugin code generator.
native.bind(
name = "grpc_cpp_plugin",
actual = "@grpc//:grpc_cpp_plugin",
)
native.bind(
name = "grpc_lib",
actual = "@grpc//:grpc++_unsecure",
)
native.new_git_repository(
name = "jsoncpp_git",
remote = "https://github.com/open-source-parsers/jsoncpp.git",
commit = "11086dd6a7eba04289944367ca82cea71299ed70",
build_file = path_prefix + "jsoncpp.BUILD",
)
native.bind(
name = "jsoncpp",
actual = "@jsoncpp_git//:jsoncpp",
)
native.new_git_repository(
name = "boringssl_git",
commit = "e72df93461c6d9d2b5698f10e16d3ab82f5adde3",
remote = "https://boringssl.googlesource.com/boringssl",
build_file = path_prefix + "boringssl.BUILD",
)
native.bind(
name = "boringssl_err_data_c",
actual = "@//" + path_prefix + "third_party/boringssl:err_data_c",
)
native.new_git_repository(
name = "nanopb_git",
commit = "1251fa1",
remote = "https://github.com/nanopb/nanopb.git",
build_file = path_prefix + "nanopb.BUILD",
)
native.bind(
name = "nanopb",
actual = "@nanopb_git//:nanopb",
)
native.new_http_archive(
name = "avro_archive",
url = "http://www-us.apache.org/dist/avro/avro-1.8.0/cpp/avro-cpp-1.8.0.tar.gz",
sha256 = "ec6e2ec957e95ca07f70cc25f02f5c416f47cb27bd987a6ec770dcbe72527368",
build_file = path_prefix + "avro.BUILD",
)
native.new_http_archive(
name = "boost_archive",
url = "http://pilotfiber.dl.sourceforge.net/project/boost/boost/1.61.0/boost_1_61_0.tar.gz",
sha256 = "a77c7cc660ec02704c6884fbb20c552d52d60a18f26573c9cee0788bf00ed7e6",
build_file = path_prefix + "boost.BUILD",
)
native.new_http_archive(
name = "bzip2_archive",
url = "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz",
sha256 = "a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd",
build_file = path_prefix + "bzip2.BUILD",
)
native.new_http_archive(
name = "zlib_archive",
url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
strip_prefix = "zlib-1.2.8",
build_file = str(Label("//third_party:zlib.BUILD")),
)
sorry for incomplete guide.
- ./tf_models/syntaxnet/WORKSPACE
new_http_archive(
name = "ts_zlib_archive",
url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
strip_prefix = "zlib-1.2.8",
build_file = "zlib.BUILD",
)
- ./tensorflow/tensorflow/workspace.bzl
native.new_http_archive(
name = "zlib_archive",
url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
build_file = path_prefix + "zlib.BUILD",
)
- ./tf_models/syntaxnet/tensorflow/tensorflow/workspace.bzl
native.new_http_archive(
name = "zlib_archive",
url = "http://zlib.net/fossils/zlib-1.2.8.tar.gz",
sha256 = "36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d",
strip_prefix = "zlib-1.2.8",
build_file = path_prefix + "zlib.BUILD",
)
it is possible to use bazel 0.3.2
with some modification.
but i found bazel version 0.2.2b
more suitable as @bazhura mentioned.
especially bazel 0.3.2
does not work for exporting model.
https://github.com/dsindex/syntaxnet/blob/master/README_api.md
I have build with bazel 0.2.2b. I have no error when building. But when I start the server and query with node, I got undefined
for the node client and this error for the server:
I tensorflow_serving/example/parsey_api.cc:89] received text:0:This is the first sentence
I tensorflow_serving/example/parsey_api.cc:89] received text:1:I love this sentence
I tensorflow_serving/example/parsey_api.cc:93] input to tensor: Placeholder:0
W external/org_tensorflow/tensorflow/core/framework/op_kernel.cc:955] Not found: syntaxnet/models/parsey_mcparseface/context.pbtxt
E external/org_tensorflow/tensorflow/core/framework/op_segment.cc:53] Create kernel failed: Not found: syntaxnet/models/parsey_mcparseface/context.pbtxt
E external/org_tensorflow/tensorflow/core/common_runtime/executor.cc:334] Executor failed to create kernel. Not found: syntaxnet/models/parsey_mcparseface/context.pbtxt
[[Node: DocumentSource = DocumentSource[batch_size=1024, corpus_name="stdin", documents_from_input=true, task_context="syntaxnet/models/parsey_mcparseface/context.pbtxt", _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_Placeholder_0)]]
I tensorflow_serving/example/parsey_api.cc:102] ran session once Not found: syntaxnet/models/parsey_mcparseface/context.pbtxt
[[Node: DocumentSource = DocumentSource[batch_size=1024, corpus_name="stdin", documents_from_input=true, task_context="syntaxnet/models/parsey_mcparseface/context.pbtxt", _device="/job:localhost/replica:0/task:0/cpu:0"](_recv_Placeholder_0)]] 0 output tensors available
Segmentation fault (core dumped)
it seems i skipped an instruction to make soft link.
you need to run
$ ln -s ./tf_models/syntaxnet/syntaxnet syntaxnet
...
# append build instructions to serving/tensorflow_serving/example/BUILD
$ cat api/append_BUILD >> serving/tensorflow_serving/example/BUILD
# create softlink
$ ln -s ./tf_models/syntaxnet/syntaxnet syntaxnet
# copy parsey_api.cc, parsey_api.proto to example directory to build
$ cp api/parsey_api* serving/tensorflow_serving/example/
# build parsey_api
$ cd serving
# please check bazel version == 0.2.2b
$ bazel --output_user_root=bazel_root build --nocheck_visibility -c opt -s //tensorflow_serving/example:parsey_api --genrule_strategy=standalone --spawn_strategy=standalone --verbose_failures
...
@sofo23
after inspecting the soft link and the reason of its presence, i found that it is not necessary and wired in this step.
so i modified api/parser_model/assets/context.pbtxt
input {
name: "tag-map"
Part {
file_pattern: "tag-map"
}
}
input {
name: "tag-to-category"
Part {
file_pattern: "fine-to-universal.map"
}
}
input {
name: "word-map"
Part {
file_pattern: "word-map"
}
}
input {
name: "label-map"
Part {
file_pattern: "label-map"
}
}
input {
name: "prefix-table"
Part {
file_pattern: "prefix-table"
}
}
input {
name: "suffix-table"
Part {
file_pattern: "suffix-table"
}
}
https://github.com/dsindex/syntaxnet/blob/master/README_api.md