Skip to content

Latest commit

 

History

History
81 lines (63 loc) · 2.79 KB

README.md

File metadata and controls

81 lines (63 loc) · 2.79 KB

Experiment Tracking with MLflow 📈

Interactive guide to experiment tracking with MLflow.

Open In Colab

Set up mlflow tracking server

  1. Create an Azure Container Registry if you don't have one yet:
az acr create --resource-group <YOUR_RESOURCE_GROUP> --name <YOUR_ACR_REGISTRY_NAME> --sku Basic --admin-enabled true
  1. Fill in the .env file in this project:
    • RESOURCE_GROUP: The name of your resource group (<YOUR_RESOURCE_GROUP> from step 1)
    • ACR_NAME: The name of your Azure Container Registry (<YOUR_ACR_REGISTRY_NAME> from step 1)
    • ACR_CONTAINER_NAME: The name of your container image (e.g. mlflow_image)
    • ACR_USERNAME: The username of your ACR
    • ACR_PASSWORD: The password of your ACR
    • AKS_CLUSTER_NAME: The name of your AKS cluster (free to choose)

Note: You can find your ACR credentials with: az acr credential show --name <YOUR_ACR_REGISTRY_NAME>

  1. Export the environment variables from the .env file:
set -a
source .env
set +a
  1. Build the container image:
docker build --platform linux/amd64 . -t ${ACR_NAME}.azurecr.io/${ACR_CONTAINER_NAME}:latest
  1. Push the container image to your ACR:
az login
az acr login --name $ACR_NAME
docker push ${ACR_NAME}.azurecr.io/${ACR_CONTAINER_NAME}:latest

Note: You can check if the image is pushed to your ACR with: az acr repository list --name $ACR_NAME --output table

  1. Create an AKS cluster:
az aks create --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --node-count 1 --generate-ssh-keys
  1. Get the credentials for your AKS cluster:
az aks get-credentials --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME
  1. Create a Kubernetes secret for your ACR:
kubectl create secret docker-registry acr-secret --docker-server=$ACR_NAME.azurecr.io --docker-username=$ACR_USERNAME --docker-password=$ACR_PASSWORD
  1. Apply the deployment file to your AKS cluster:
kubectl apply -f mlflow-deployment.yaml
  1. Wait for the external IP to be assigned to the service. You can check the status with:
kubectl get service mlflow-service --watch

Once the EXTERNAL-IP is assigned, you can access your MLflow instance using that IP address on port 80 (i.e., http://< EXTERNAL-IP >/).

  1. Cleanup
az group delete --name $RESOURCE_GROUP

Or, if you want to keep your resource group, you can delete the AKS cluster and/or the ACR registry:

az aks delete --resource-group $RESOURCE_GROUP --name $AKS_CLUSTER_NAME --yes --no-wait
az acr delete --resource-group $RESOURCE_GROUP --name $ACR_NAME --yes --no-wait