Skip to content

Instantly share code, notes, and snippets.

@pzelasko
Last active May 8, 2021 09:26
Show Gist options
  • Save pzelasko/e5800247865edda8aa4cda8d5e7c628a to your computer and use it in GitHub Desktop.
Save pzelasko/e5800247865edda8aa4cda8d5e7c628a to your computer and use it in GitHub Desktop.
Build TensorFlow Serving 1.14 on CentOS 7
#!/bin/bash
# Requires Python 3.6 virtualenv
source ~/venv36/bin/activate
# Java
sudo yum -y install java-1.8.0-openjdk-devel
# Build Esentials (minimal)
sudo yum -y install gcc gcc-c++ kernel-devel make automake autoconf swig git unzip libtool binutils
# Extra Packages for Enterprise Linux (EPEL) (for pip, zeromq3)
sudo yum -y install epel-release
# Other TF deps
sudo yum -y install freetype-devel libpng12-devel zip zlib-devel giflib-devel zeromq3-devel
# Python utils
pip --no-cache-dir install \
"future>=0.17.1" \
grpcio \
h5py \
keras_applications \
keras_preprocessing \
mock \
numpy \
requests
# Bazel
export PATH="$PATH:$HOME/bin"
echo "Installing bazel"
pushd /var/tmp
VERSION=0.24.1
wget https://github.com/bazelbuild/bazel/releases/download/$VERSION/bazel-$VERSION-installer-linux-x86_64.sh
chmod u+x bazel-$VERSION-installer-linux-x86_64.sh
./bazel-$VERSION-installer-linux-x86_64.sh --user
popd
# TF Serving
git clone https://github.com/tensorflow/serving -b r1.14
pushd serving
TF_SERVING_BUILD_OPTIONS="--config=nativeopt"
bazel build --color=yes --curses=yes \
--verbose_failures \
--output_filter=DONT_MATCH_ANYTHING \
${TF_SERVING_BUILD_OPTIONS} \
tensorflow_serving/model_servers:tensorflow_model_server
cp bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server ..
popd
echo Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment