How to setting up environment for tensor flow developement - tensorflow

I cloned tensorflow repository to my pc. How should I setting up my environment for development?I have no I idea about avaialable files

If you want to start simple(not build tensorflow from source by yourslef), you can follow this link to install it.
Then you can go through this tutorial to get familiar with how tensorflow works.
I believe the best documents for tensorflow are all on its official site(As you can see, the two links above are all from the official site of tensorflow).

Related

Deploying Tensorflow models as Windows exe

I want to use Tensorflow 1.4 for my ML modeling needs. My use case requires:
Training the model on GPU <--- I know how to do this with TF
Deploying the trained model on an ordinary box - as an .exe on CPU running Windows (for inference) <----
I don't know how to do this.
Can somebody tell me if TF 1.4 supports this and if so, point me to a guide or explain how its done ?
This is a little late but this video on youtube covers it pretty well.
He uses pyinstaller which grabs everything needed and puts it all either into one executable without anything else, or a folder with the exe in there and other stuff.
I've tried this myself and it works pretty well, although since pyinstaller smashes everything needed into one folder which gets really huge, it includes the entire tensorflow library, the python interpreter and if you use tensorflow-gpu, it also includes the cudnn files as well which are like 600mb, effectively leaving you with over a 1gb worth of files in the end.
That can be reduced by excluding modules that you don't need, I recommend creating a virtual environment and start with a clean installation of python.
Hope this helps in anyway.

Official Tensorflow docs available in pdf form? (running Windows)

I have not been able to find pdf format docs for Tensorflow (API or tutorials).
I'm referring to the official docs, not asking for book recommendations.
Specifically pdf format, for offline local reference and study.
One problem is that I'm running Windows, so the available toolset for creating
them dynamically is limited (or different from the normally recommended tools).
But surely the pdfs must already exist online somewhere, right?
This has been answered here. How can you download Tensorflow API Documentation
Essentially you can use http://devdocs.io/, which can provide you with offline access to the documentation of many libraries and languages, including Tensorflow.
Or clone the repo and type this to generate a the documentation locally. It's described in more detail in the TensorFlow documentation.
$ cd tensorflow/tools/docs
$ ./gen_docs.sh # add -a if you want C++ documentation
If you can't do this approach due to Windows, then versus setting up a bunch of infrastructure, it maybe easier to use the gitbook for TF then generate a PDF with toolchain as described here

TensorFlow + cloud-ml : deploy custom native op / reader

I was wondering if it was possible to deploy Tensorflow custom ops or custom reader written in C++ inside cloud-ml.
It looks like cloud-ml does not accept running native code in its standard mode (I'm not really interested in using a virtualized environment), at least for Python package they only accept pure python with no C dependency.
Likely the easiest way to do this is to include as an extra package the build of the entire custom Tensorflow Wheel that includes the op. For specifying extra packages see: https://cloud.google.com/ml-engine/docs/how-tos/packaging-trainer#to_include_custom_dependencies_with_your_package
For building a TF wheel from source see: https://www.tensorflow.org/install/install_sources#build_the_pip_package
You could also try to download/install just the .so file for the new op, but that would require either downloading it inside the setup.py of your training package or inside the training python code itself.
Note that you can currently only upload custom packages during Training, and not during Batch or Online Prediction, so a model trained using a custom TF version may not work with the prediction service.

CNTK deployment for real time predictions

TensorFlow has a separate project for its production usage, as noted here, called TensorFlow Serving.
How should I use CNTK in a production environment, and how should I handle it's deployment? Hopefully one could deploy trained models in to a server/cluster that serves the model with RPC or HTTP REST API.
If no such tool exists, what should be the first steps to develop it and a good architecture to roll out on my own?
We do support serving CNTK models in a production environment. You can find information about model evaluation/inference: https://github.com/Microsoft/CNTK/wiki/CNTK-Evaluation-Overview. For deployment, you need deploy the dlls specified here. A tutorial for deploying CNTK in Azure is available here.
No such tool exists from the CNTK team, but the new APIs in C++ or python should make the task pretty easy once you have a trained model.

How to combine bazel artifacts from tensorflow tensorflow-serving and syntaxnet?

I have built syntaxnet, and tensorflow-serving using bazel. Both embed their own (partial?) copy of tensorflow itself. I already have the problem where I'd like to "import" some parts of tensorflow-serving in a script that "lives" in the syntaxnet tree which I can't figure out (without doing some VERY ugly things).
Now I'd like "tensorboard", but that apparently doesn't get built as part of the embedded tensorflow inside of syntaxnet or tensorflow-serving.
So now I'm sure "I'm doing it wrong". How am I supposed to be combining the artifacts built by various separate bazel workspaces?
In particular, how can I build tensorflow (with tensorboard) AND syntaxnet AND tensorflow-serving and have them "installed" for use so I can start writing my own scripts in a completely separate directory/repository?
Is "./bazel-bin/blah" really the end-game with bazel? There is no "make install" equivalent?
You're right, currently Tensorboard targets are only exposed in the Tensorflow repo, and not the other two that use it. That means that to actually bring up Tensorboard, you'll need to checkout Tensorflow on its own and compile/run Tensorboard there (pointing it to the generated logdir).
Actually generating the training summary data in a log directory is done during training, in your case in the tensorflow/models repo. It looks like SummaryWriter is used in inception_train.py, so perhaps you can add something similar to syntaxnet. If that doesn't work and you're not able to link Tensorboard, I'd recommend filing an issue in tensorflow/models to add support for Tensorboard there. You shouldn't need Tensorboard in Tensorflow Serving.
Importing parts of Tensorflow Serving in syntaxnet would require you to add this new depedency as a submodule (like is done with tensorflow) or possibly a git_repository in the WORKSPACE file if that works. We've never tried this, so it's possible that something is broken for this untested use case. Please file issues if you encounter a problem with this.
As for just installing and running, Tensorflow Serving doesn't support that right now. It's a set of libraries that you link in directly into your server binary and compile (the repo offers some example servers and clients), but right now there is no simple "installed server". Tensorflow along with Tensorboard however can be installed and linked from anywhere.