Tensorflow
Tensorflow record
1. Download Tensorflow
2. Create a simple model
1 |
https://www.tensorflow.org/tutorials/keras/save_and_restore_models |
3. Training
The primary use case is to automatically save checkpoints during and at the end of training. This way you can use a trained model without having to retrain it, or pick-up training where you left of—in case the training process was interrupted.
tf.keras.callbacks.ModelCheckpoint is a callback that performs this task. The callback takes a couple of arguments to configure checkpointing.
A. Deploy using Docker
1. install tensorflow serving with docker
2.run docker image
1 2 3 |
docker run -p 8501:8501 \ --mount type=bind,source=<em>YOUR PATH</em>/tensorflow/tfserving/serving/tensorflow_serving/servables/tensorflow/testdata/saved_model_half_plus_two_cpu,target=/models/half_plus_two \ -e MODEL_NAME=half_plus_two -t tensorflow/serving & |
B. Deploy with Kubernetes
1.Export the Inception model
1 2 3 |
git clone https://github.com/tensorflow/serving cd serving rm -rf ./models/inception |
Build TensorFlow Serving Inception model exporter
1 |
tools/bazel_in_docker.sh bazel build -c opt tensor</code>flow_serving/example:inception_saved_model |
Error:
/tensorflow/serving/.cache/_bazel_jfan/7a4a59242df6fd82e0e4108ffd6fce39/external/org_tensorflow/tensorflow/core/BUILD:2101:1: no such package '@zlib_archive//': java.io.IOException: Error downloading [https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz, https://zlib.net/zlib-1.2.11.tar.gz] to /tensorflow/serving/.cache/_bazel_jfan/7a4a59242df6fd82e0e4108ffd6fce39/external/zlib_archive/zlib-1.2.11.tar.gz: All mirrors are down: [sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target] and referenced by '@org_tensorflow//tensorflow/core:lib_internal_impl'
One thought