Sto provando a creare un progetto che utilizza TensorFlow Serving, quindi ho creato una directory my_dir con un file WORKSPACE, clonato il repository di servizio, messo i miei file personalizzati in una directory my_project, configurato in tensorflow all'interno di tensorflow_serving , costruita tensorflow servire da my_dir/porzione conProgetti nidificati Bazel
bazel build //tensorflow_serving/...
tutto costruisce bene lì, quindi cerco di creare un file python imita mnist_export e metterlo in my_dir e fare un build file
py_binary(
name = "export_cnn",
srcs = [
"export_cnn.py",
],
deps = [
"@tf//tensorflow:tensorflow_py",
"@tf_serving//tensorflow_serving/session_bundle:exporter",
],
)
Tuttavia, quando corro
bazel build //my_project:export_cnn
ottengo i seguenti errori:
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.
Nel mio file di lavoro, ho le seguenti:
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")
La mia ipotesi è che perché tensorflow è un sotto-sotto-progetto non sta mettendo i suoi file generati nei progetti per nonni bazel-out. Tuttavia, ho provato molte cose e non sono riuscito a farlo funzionare.