Title | Serving Production Models | ![]() |
Duration | 60 min | |
Module | B | |
Lesson Type | Tutorial | |
Focus | Practical - Organisational AI | |
Topic |
Building production model API |
machine learning opertion,containers,
None.
The materials of this learning event are available under CC BY-NC-SA 4.0.
Production Models using TFX Serving
Duration (Min) | Description |
---|---|
20 | Problem 1: Building a CNN model using a subset of the Stanford dogs dataset, saving this model as a Tensorflow model |
10 | Problem 2: Deploying the Tensorflow model to a Rest API locally (using Docker) and querying the model |
20 | Problem 3: Deploying the Tensorflow model to a Rest API using Azure Container Instances (ACI) (using Docker) and querying the model |
10 | Recap on the forward pass process |
The following command line interface commands are used in this tutorial to run the models.
Step 1: Pull tensorflow
docker pull tensorflow/serving:latest-gpu
Step 2: Run the image
docker run --gpus all -p 8501:8501 --name tfserving_classifier --mount type=bind,source=c:\production\,target=/models/img_classifier -e MODEL_NAME=img_classifier -t tensorflow/serving:latest-gpu
or with no GPU
docker run -p 8501:8501 --name tfserving_classifier --mount type=bind,source=c:\production\,target=/models/img_classifier -e MODEL_NAME=img_classifier -t tensorflow/serving:latest-gpu
Step 1: Modify the local image to have model included
docker run -d --name serving_base tensorflow/serving:latest-gpu docker cp c:\production\ serving_base:/models/img_classifier docker ps -a# to get id docker commit --change "ENV MODEL_NAME img_classifier" <id goes here> tensorflow_dogs_gpu docker kill serving_base
Step 2: Deploy Image to Azure ACI
docker login azure docker context create aci deleteme docker context use deleteme docker run -p 8501:8501 kquille/tensorflow_dogs_gpu:kq
Step3 Access the ACI logs, IP address, and then stop and remove the ACI service =====
docker logs jolly-ride docker ps docker stop jolly-ride docker rm jolly-ride
Click here for an overview of all lesson plans of the master human centred AI
Please visit the home page of the consortium HCAIM
![]() |
The Human-Centered AI Masters programme was co-financed by the Connecting Europe Facility of the European Union Under Grant №CEF-TC-2020-1 Digital Skills 2020-EU-IA-0068. The materials of this learning event are available under CC BY-NC-SA 4.0
|
The HCAIM consortium consists of three excellence centres, three SMEs and four Universities |