Created
January 27, 2017 16:18
-
-
Save YePpHa/39c3667b57e1ab60d55fc12692726e92 to your computer and use it in GitHub Desktop.
Updated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use with this Dockerfile https://gist.github.com/johndpope/d41a7d6daf8652cbdaff41a2b063c801 | |
# Updated from https://gist.githubusercontent.com/johndpope/fc1c2327a4ae255d9c44dda9b67b5288/raw/406369ecc157d60f7a9bac2a0d5be3da9aa62e56/parseyapi.sh | |
# https://github.com/dsindex/syntaxnet/blob/master/README_api.md | |
cd / | |
git clone https://github.com/YePpHa/syntaxnet.git work | |
cd work | |
git clone --recurse-submodules https://github.com/tensorflow/serving | |
# checkout proper version of serving | |
cd serving | |
git checkout 89e9dfbea055027bc31878ee8da66b54a701a746 | |
git submodule update --init --recursive | |
# checkout proper version of tf_models | |
cd tf_models | |
git checkout a4b7bb9a5dd2c021edcd3d68d326255c734d0ef0 | |
# apply patch by dmansfield to serving/tf_models/syntaxnet | |
cd serving/tf_models | |
patch -p1 < ../../api/pr250-patch-a4b7bb9a.diff.txt | |
cd ../../ | |
# configure serving/tensorflow | |
cd serving/tensorflow | |
echo "\n\n\n\n" | ./configure | |
cd ../../ | |
# modify serving/tensorflow_serving/workspace.bzl for referencing syntaxnet | |
cp api/modified_workspace.bzl serving/tensorflow_serving/workspace.bzl | |
cat api/modified_workspace.bzl | |
# ... | |
# native.local_repository( | |
# name = "syntaxnet", | |
# path = workspace_dir + "/tf_models/syntaxnet", | |
# ) | |
# ... | |
# update workspace.bzl for tensorflow/tensorflow/workspace.bzl | |
cp api/modified_workspace-zlib.bzl serving/tensorflow/tensorflow/workspace.bzl | |
cat api/modified_workspace-zlib.bzl | |
# append build instructions to serving/tensorflow_serving/example/BUILD | |
cat api/append_BUILD >> serving/tensorflow_serving/example/BUILD | |
# 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 | |
#disable cuda on osx | |
bazel clean --expunge && export TF_NEED_CUDA=0 | |
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 --local_resources 2048,.5,1.0 | |
# make softlink for referencing 'syntaxnet/models/parsey_mcparseface/context.pbtxt' | |
ln -s ./tf_models/syntaxnet/syntaxnet syntaxnet | |
# run parsey_api with exported model | |
#./bazel-bin/tensorflow_serving/example/parsey_api --port=9000 ../api/parsey_model |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment