TensorFlow Serving を使用するプロジェクトを構築しようとしているので、WORKSPACE ファイルを含むディレクトリ my_dir を作成し、そこにサービス リポジトリを複製し、カスタム ファイルをディレクトリ my_project に配置し、tensorflow_serving 内で tensorflow を構成し、my_dir から tensorflow serving を構築しました。 /奉仕する
bazel build //tensorflow_serving/...
すべてがそこで正常にビルドされたら、mnist_export を模倣した python ファイルをビルドし、それを my_dir に入れて BUILD ファイルを作成しようとします
py_binary(
name = "export_cnn",
srcs = [
"export_cnn.py",
],
deps = [
"@tf//tensorflow:tensorflow_py",
"@tf_serving//tensorflow_serving/session_bundle:exporter",
],
)
ただし、実行すると
bazel build //my_project:export_cnn
次のエラーが表示されます。
ERROR:
.../bazel/_bazel_me/3ef3308a843af155635e839105e8da5c/external/tf/tensorflow/core/BUILD:92:1: null failed: protoc failed: error executing command bazel-out/host/bin/external/tf/google/protobuf/protoc '--cpp_out=bazel-out/local_linux-fastbuild/genfiles/external/tf' -Iexternal/tf -Iexternal/tf/google/protobuf/src ... (remaining 1 argument(s) skipped).
tensorflow/core/framework/step_stats.proto: File not found.
tensorflow/core/framework/device_attributes.proto: File not found.
tensorflow/core/framework/graph.proto: File not found.
tensorflow/core/framework/tensor.proto: File not found.
tensorflow/core/protobuf/config.proto: File not found.
tensorflow/core/protobuf/worker.proto: Import "tensorflow/core/framework/step_stats.proto" was not found or had errors.
tensorflow/core/protobuf/worker.proto: Import "tensorflow/core/framework/device_attributes.proto" was not found or had errors.
tensorflow/core/protobuf/worker.proto: Import "tensorflow/core/framework/graph.proto" was not found or had errors.
tensorflow/core/protobuf/worker.proto: Import "tensorflow/core/framework/tensor.proto" was not found or had errors.
tensorflow/core/protobuf/worker.proto: Import "tensorflow/core/protobuf/config.proto" was not found or had errors.
tensorflow/core/protobuf/worker.proto:41:12: "DeviceAttributes" is not defined.
tensorflow/core/protobuf/worker.proto:64:3: "GraphDef" is not defined.
tensorflow/core/protobuf/worker.proto:72:3: "GraphOptions" is not defined.
tensorflow/core/protobuf/worker.proto:141:3: "TensorProto" is not defined.
tensorflow/core/protobuf/worker.proto:180:3: "StepStats" is not defined.
tensorflow/core/protobuf/worker.proto:225:3: "BusAdjacency" is not defined.
tensorflow/core/protobuf/worker.proto:227:3: "BusAdjacency" is not defined.
tensorflow/core/protobuf/worker.proto:232:3: "TensorProto" is not defined.
tensorflow/core/protobuf/worker.proto:272:3: "StepStats" is not defined.
私の WORKSPACE ファイルには、次のものがあります。
local_repository(
name = "tf",
path = __workspace_dir__ + "/serving/tensorflow",
)
local_repository(
name = "tf_serving",
path = __workspace_dir__ + "/serving",
)
load('//serving/tensorflow/tensorflow:workspace.bzl', 'tf_workspace')
tf_workspace("serving/tensorflow/", "@tf")
私の仮説は、テンソルフローはサブサブプロジェクトであるため、生成されたファイルを祖父母プロジェクトのバゼルアウトに配置していないということです。しかし、私は多くのことを試しましたが、それを機能させることができませんでした。