Skip to content

Instantly share code, notes, and snippets.


wai chee yau waichee

  • Melbourne, Australia
View GitHub Profile
# Some Google CLI commands to setup dataproc and Big Query etc
# create dataproc cluster with Jupyterhub
gcloud compute ssh --zone="us-central1-c" \
--ssh-flag="-D" --ssh-flag="10000" --ssh-flag="-N" "${cluster_name}-m" \
--initialization-actions \
# Proxy and access UI of cluster
#Run a single test
bazel test -c opt //tensorflow_serving/sources/storage_path:file_system_storage_path_source_test
# This script is used to compile Tensorflow Serving protobuf definition into Python
# The generated definitions in Python are stored in the tensorflow_serving_apis folder
# Usage:
# ./ 333325e413e9680d67ae90196fa123f5271fcf615
: ${1?”Error. Please provide the Tensorflow Serving git commit hash/branch name. Usage: ./ my_awesome_branch “}
script_dir=”$( cd$( dirname “${BASH_SOURCE[0]})&& pwd )
ts_git_revision=$1 #branch/release or commit hash
local_ts_api_dir=”${script_dir}/tensorflow_serving_apis/” #directory that stores the compiled python proto definition
waichee /
Last active Jan 13, 2019
Code to Build Tensorflow Serving from source within a Docker container
mkdir -p /work/
# Clone the source from Github
cd /work/ && git clone — recurse-submodules
# Pin the version of Tensorflow Serving and its submodule
cd /work/serving && git checkout $TENSOR_SERVING_COMMIT_HASH
waichee /
Created Feb 14, 2017
Steps to create a docker container with dependencies required for compiling Tensorflow Serving
# Clone the Tensorflow Serving source
git clone
cd serving && git checkout <commit_hash>
# Build the docker image (time to go get yourself a coffee, maybe a meal as well, this will take a while.)
docker build -t some_user_namespace/tensorflow-serving:latest -f ./serving/tensorflow_serving/tools/docker/Dockerfile.devel .
# Run up the Docker container in terminal
docker run -ti some_user_namespace/tensorflow-serving:latest
import time
import random
# A dummy script which keeps increasing the number of string added to list a
thing = "hi"
a = []
for i in range(1000):
a.append(thing * random.randint(1000,2000))
# install the required packages
pip install memory_profiler
pip install matplotlib
# run the profiler to record the memory usage
# sample 0.1s by defaut
mprof run --include-children python
# plot the recorded memory usage
mprof plot --output memory-profile.png