how to compile summarize_graph with bazel in Tensorflow - tensorflow

I am testing a Movidius Neural Compute stick.
My first test is to replicate this guide with Inception_v4 model:
https://movidius.github.io/ncsdk/tf_modelzoo.html
I do need to know the "output_node_name" for the freeze_graph.py.
I have found instructions to do so in tensorflow docs:
bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=MY_PB_FILE.pb
However, when trying to follow steps, I get the following error:
lberto#alberto-OptiPlex-9010:~/movidius_ws$ bazel build tensorflow/tools/graph_transforms:summarize_graph
Starting local Bazel server and connecting to it...
ERROR: Skipping 'tensorflow/tools/graph_transforms:summarize_graph': no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path
WARNING: Target pattern parsing failed.
ERROR: no such package 'tensorflow/tools/graph_transforms': BUILD file not found on package path
INFO: Elapsed time: 0.947s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
According to the guide provided by Movidius, it is not necessary to install tensorflow in the host, only download the source code. I have cloned the Tensorflow source code in a directory to follow the guide, and the movidius tools in a docker container sharing that directory.
What am I doing wrong building the summarize_graph application?
I need to have this application running to know the output_node_names that I want to use with the movidius neural compute stick
Thank you.

Make sure the following files exist:
"~/movidius_ws/WORKSPACE"
"~/movidius_ws/tensorflow/tools/graph_transforms/BUILD" or "~/movidius_ws/tensorflow/tools/graph_transforms/BUILD.bazel"
If they do, check the list of targets in the "//tensorflow/tools/graph_transforms" package:
bazel query //tensorflow/tools/graph_transforms:*
and see if "summarize_graph" is there.

Related

Tensorflow c++ windows bazel build giving error while reading extensions file

hey guys im trying to install tensorflow
c++ on windows 10 but im running into this
issue when i try to do the bazel command
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
As a basic sanity check to resolve your problem, you need to make sure you are running a specific version of TensorFlow using the recommended bazel build tool as specified in the instructions:
https://www.tensorflow.org/install/source
For example, TensorFlow v0.9 should go with Bazel tool v0.11.0. Could you provide this information for you case ?

Error while building TensorFlow from source

I am trying to build TensorFlow cpu only r1.11 from source on a Debian OS following this tutorial: https://www.tensorflow.org/install/source
I installed bazel as indicated using this tutorial https://docs.bazel.build/versions/master/install-ubuntu.html from the binary installer as recommended.
Then I followed each step and everything worked fine until this command:
bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...
It shows me this error:
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.
INFO: Elapsed time: 0.088s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)
I read online that this is likely related to bazel. So I tried reinstalling bazel using the Using Bazel custom APT repository but I got the same error.
As of version 1.12.0, TensorFlow uses some deprecated Bazel features that are being completely dropped in recent versions of Bazel. Instead of using the most recent version, try using an older one for now. I was able to build TensorFlow 1.12.0 on Windows using Bazel 0.18.1, most likely that should work with TensorFlow 1.11 too.
I agree with #jdehesa. Even I was struggling to build the tensorflow using from scratch. I tried different versions, 0.26,0.21,0.19.1 and finally it worked with 0.18.1. So, it is a bazel issue rather than Tensorflow. TF_version=1.12.0

Tensorflow Custom Compile on Windows

So, I've installed Bazel via Chocolatey, installed Python 3.5 and 2.7, installed CUDA v8, and cuDNN v6, and installed JDK 8.0, I'm now trying to custom-build TensorFlow on my Windows 10 device, with AVX, AVX 2 and CUDA. TensorFlow-GPU, the pre-built version, does work, I've already tested and run that successfully.
I've followed the instructions of other articles, both on TensorFlows' actual site (trying to adapt some sections from the Linux/Mac installs), and on here. The furthest I've made it is; cloning the Github repository via Msys2, running configure.py, then attempting to build via bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package I receive an error, the header of which is:
Error reading java.io.IOException: CreateProcess(): The system cannot find the file specified.
: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/include/cudnn.h
I've double checked, that file does exist, so I'm not sure why I'm getting this error.
EDIT: Also attempted to run via Powershell, reached the same point.
Any help would be much appreciated.
I had the exact same error while trying to build Tensorflow on Windows (using cuDNN 5.1). I fixed it by launching bazel from the msys2 terminal (instead of from the windows command prompt) and manually setting the BAZEL_SH environment variable before attempting to build.
export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe
bazel build -c opt --config=win-cuda tensorflow/cc:cc_ops
The following steps helped me to compile Tensorflow on Windows 10.
pacman -Syuu patch
ln -s "c:\python27\python.exe" /usr/bin/python
export BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe
"C:\Documents and Settings\All Users\chocolatey\bin\bazel.exe" build --config=opt --config=win-cuda //tensorflow/tools/pip_package:build_pip_package
But after 1 hour of compilation I got another error:
C:\tools\msys64\tmp_bazel_dmitry\x1e5egqw\execroot\org_tensorflow\external\protobuf_archive\python\google\protobuf\internal\api_implementation.cc
: fatal error C1083: Cannot open compiler generated file: '': Invalid
argument Target //tensorflow/tools/pip_package:build_pip_package
failed to build

Tensorflow build quantization tool - bazel build error

I am trying to compile the quantization script as described in Pete Warden's blog. However I get the following error message after running the following bazel build:
bazel build tensorflow/contrib/quantization/tools:quantize_graph
ERROR: no such package 'tensorflow/contrib/quantization/tools': BUILD file not found on package path.
INFO: Elapsed time: 0.277s
I think what happened is that this quantization tool got moved out of contrib and into TensorFlow core. You should be able to use that instead:
bazel build tensorflow/tools/quantization:quantize_graph

Tensor flow installation from source issue in Build your target with GPU support

This first time for me to install Tensorflow. I followed the instructions on official website here. I installed from source because I found some people advice to do that instead of pip installation. I used version r0.9 of tensorflow and I installed it on Ubuntu-mate 15.10. I followed all instructions. Installed python, cuda version 7.5, cudnn release 5. Nvidia GPU 5200 with compute capability of 2.1. Every thing went well until I reached bazel build step here,
Latitude-E6430:~/tensorflow$ bazel build -c opt --config=cuda //tensorflow/cc:tutorials_example_trainer
"Latetude-E6430" is the user of the machine.
I got the following errors immediately:
ERROR: /home/meqdad/tensorflow/tensorflow/core/BUILD:91:1: //tensorflow/core:protos_all_py: no such attribute 'imports' in 'py_library' rule.
ERROR: /home/meqdad/tensorflow/tensorflow/cc/BUILD:28:1: Target '//tensorflow/core:sparse_ops_op_lib' contains an error and its package is in error and referenced by '//tensorflow/cc:ops/sparse_ops_gen_cc'.
ERROR: Loading failed; build aborted.
I tried to find a solution to this problem, I was using bazel 0.1 then I upgraded to bazel 0.3. However, on the net, there is several issues like this one but non of them was related to this one. I re-installed py_library but it did nothing to solve the problem.
Please can you advice me how to move on with this step of installation.