Machine Learning (ML) and Artificial Intelligence (AI) have extended their capabilities of software application that you can see throughout our daily life like banking services, face recognition, photo captioning and product recommendations, etc. The challenging part about integrating AI or ML into an application is not just the technology, the math, the science behind it or the algorithms. The challenge is to deploy the model into a production environment and keep it operated and supportive.
In the same way, DevOps has become the de-facto development standard for IT operations and Cloud services. It places emphasis on process, automation and fosters a culture that encourages new ways of working together across teams.
For DevOps, it becomes essential to the IT operations to keep up with the pace, depth of the product and organization is working on. There must be software development teams who are familiar with the product flow, analytics, troubleshooting and must be able to figure out errors in the process and report accordingly.
Here, the challenge is to put human efforts to troubleshoot and finding issues.
But when it comes to putting the AI/ML and DevOps together to implement an application pipeline specific to AI/ML or to automate and wrap the application with good deployment practices, the implementation needs some effort to be successful.
How to integrate DevOps for AI/ML
Azure Machine Learning service provides customers with an asset such as management and orchestration services, enabling effective AI/ML lifecycle management. With this, the software development team can bring their Machine Learning models to production and solve their business key problems faster and more accurately than ever before.
You can build a continuous integration pipeline for an AI application. In the above diagram, the pipeline for AI application picks the latest commit from the GitHub repository and the latest pre-trained Machine Learning model from the Azure Storage container. It stores the image in a private image repository on Azure Container Registry (ACR) and deploys it on a Kubernetes cluster running on Azure container service (AKS).
Azure Machine Learning service also provides a Cloud-based environment you can use to develop, train, test, deploy, manage and track Machine Learning models.
Let’s have a look at how to build the Continuous Integration and Continuous Delivery pipelines for a Machine Learning project with Azure Pipelines.
We will use the Azure DevOps project to build and release pipelines along with Azure ML services for ML/AI model management and operation.
Before you begin
- You need a Microsoft Azure account to perform Azure labs. If you do not have one, you can sign up for a free trial.
- You will need an Azure DevOps If you do not have one, you can sign up for free here.
- Use Azure DevOps Demo Generator to provision the project on your Azure DevOps organization. This hyperlink selects the Azure Machine Learning template in the demo generator. This template contains the code and pipeline definition for a machine learning project explaining how to automate an end to end ML/AI project.
Exercise 1: Configure CI Pipeline for AI/ML Project
In this exercise, you will configure the CI pipeline for the ML/AI project. This build pipeline includes model version management, model evaluation/selection, DevOps tasks for data sanity test, model training on different compute targets, etc.
The following are the steps performed in the CI pipeline:
- Prepare an environment for Python
- Get or create the workspace for AML services
- On the remote DSVM / Local Python Env, Submit Training job
- Compare the different model performance and select the best
- In a workspace, register the model
- Docker Image to be created for Scoring Web service
- To Release Pipeline, Copy and Publish the Artifacts
Exercise 2: Configure CD Pipeline for ML/AI Project
In this exercise, the Release Pipeline will be configured. The image created from the build pipeline will deploy to Azure Container Instance and Azure Kubernetes Services.
The following are the steps performed in the CD pipeline:
- Create a release pipeline with two stages QA and Prod
- In the QA stage, create ACI (Azure Container Instance) and deploys web service image created in Build Pipeline to ACI
- Test the scoring image deployed
- Update the two tasks in Prod stage with the same Azure subscription.
Exercise 3: Update the Config file in the source code to trigger CI and CD
Navigate to Repos. Open the config.json file from the folder aml_config/ and update your Azure subscription ID. After commit, since we have enabled CI trigger, a build will be queued automatically.
- Azure Machine Learning (Azure ML) Service Workspace
- https://docs.microsoft.com/en-us/azure/machine-learning/team-data-science-process/ci-cd flask