Skip to content

Sample demonstrating how to package and deploy models for use outside Azure Machine Learning.

License

Notifications You must be signed in to change notification settings

jamesmcroft/azure-machine-learning-model-container-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Machine Learning - Packaging models for deployment outside Azure Machine Learning

This sample demonstrates how to package and deploy models outside Azure Machine Learning including the necessary Bicep to setup an Azure Machine Learning workspace environment.

This approach allows you to take the packaged model and deploy it to any environment that supports Docker containers outside the scope of Azure Machine Learning. This includes Azure Container Apps, Kubernetes, or an on-premises machine.

Components

The Bicep template deploys the following resources to a subscription of your choice:

  • Azure Machine Learning Workspace, a centralized place for data scientists and engineers to work with the data, prepare data, train, deploy, and manage models.
  • Azure Machine Learning Computer Instance, a managed cloud-based virtual machine with a Jupyter environment for the user.
    • The VM is configured with the following:
      • VM Size: Standard_E4ds_v4
      • Idle time before shutdown: 15 minutes
      • Scheduled shutdown: 6pm every day
      • Creation script: ./src/setup/setup.sh to update to the latest Azure ML SDK v2 library in the conda environment.
  • Azure Container Registry, a private Docker registry for storing the container images.
  • Azure Storage Account, a general-purpose storage account for storing the Azure Machine Learning artifacts, logs, and datasets.
  • Azure Key Vault, a managed service that can store the secrets that can be used by the Azure Machine Learning workspace, for example, database connection strings such as Snowflake.
  • Azure Log Analytics Workspace, a workspace for storing the logs generated by the Azure Machine Learning workspace, including managed endpoints.
  • Azure Managed Identity, a user-defined managed identity for the Machine Learning Workspace to access dependent resources.

Getting Started

To deploy the infrastructure and get started with the src\Run.ipynb notebook, you need to:

Prerequisites

Deploy the infrastructure

The components section above describes the resources that will be deployed.

The deployment occurs at the subscription level, creating a new resource group. The location of the deployment is set to UK South and this can be changed, as well as other parameters, in the ./infra/main.bicepparam file.

You must update or remove the computeInstanceUsers parameter to include your Azure AD user object ID from your tenant. If you wish to add multiple users, the parameter is an array and you can include more. This will deploy the same configuration detailed in the components section for the compute instance for each user.

  1. Clone the repository.
  2. Open a PowerShell terminal at the root of the repository.
  3. Run the following command to deploy the infrastructure (replacing any parameters as needed):
az deployment sub create --name 'machinelearning' --location uksouth --template-file ./infra/main.bicep --parameters ./infra/main.bicepparam

This may take up to 10 minutes to complete on the first run.

Clone the repository to a compute instance

  1. From the Notebooks tab in the Azure Machine Learning workspace, open the workspace in VS Code (Web).
  2. Open a terminal in VS Code and clone this repository to the compute instance.
  3. Open the ./src/Run.ipynb notebook to continue your journey with packaging and deploying models outside Azure Machine Learning.

About

Sample demonstrating how to package and deploy models for use outside Azure Machine Learning.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published