{"id":22986203,"url":"https://github.com/csiebler/mlops-demo","last_synced_at":"2025-08-13T20:33:02.088Z","repository":{"id":55884695,"uuid":"239745445","full_name":"csiebler/mlops-demo","owner":"csiebler","description":"Demo for MLOps with Azure Machine Learning","archived":false,"fork":false,"pushed_at":"2022-07-05T07:31:46.000Z","size":178,"stargazers_count":11,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-08-10T00:46:17.534Z","etag":null,"topics":["azure-devops","azure-machine-learning"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csiebler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-11T11:26:56.000Z","updated_at":"2023-08-03T04:42:01.000Z","dependencies_parsed_at":"2022-08-15T08:31:54.776Z","dependency_job_id":null,"html_url":"https://github.com/csiebler/mlops-demo","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiebler%2Fmlops-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiebler%2Fmlops-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiebler%2Fmlops-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csiebler%2Fmlops-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csiebler","download_url":"https://codeload.github.com/csiebler/mlops-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229780079,"owners_count":18122917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-devops","azure-machine-learning"],"created_at":"2024-12-15T03:40:30.437Z","updated_at":"2024-12-15T03:40:30.894Z","avatar_url":"https://github.com/csiebler.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mlops-demo\n\nThis repo shows some introduction examples to Azure Machine Learning and a simple MLOps implemenation for automating model training and deployment.\n\n## Setup \u0026 Demo Flow\n\nThis gives a short, high-level overview of how this repo may be used.\n\n### Interactive demo part\n\n1. If required, create an Azure Machine Learning workspace\n1. Create a tabular dataset from [`data/german_credit_data.csv`](data/german_credit_data.csv) and name it `german_credit_dataset` (download the file to your machine and select `From Local File` when creating a new Dataset)\n1. Create a file dataset from [`data/german_credit_data.csv`](data/german_credit_data.csv) and name it `german_credit_file` (use `From Datastore` and point to the same file as in the prior step)\n1. Clone the whole repo into a Compute Instance\n1. Walk through the following notebooks\n    * [`models/german-credit-basic/notebooks/german-credit-local.ipynb`](models/german-credit-basic/notebooks/german-credit-local.ipynb) - Shows how to run local training inside the Compute Instance, registers the model with data linage, and calculates the model explainability\n    * [`models/german-credit-basic/notebooks/german-credit-amlcompute.ipynb`](models/german-credit-basic/notebooks/german-credit-amlcompute.ipynb) - Shows how to train the same model on a Compute Cluster\n    * [`models/german-credit-basic/notebooks/deploy_webservices.ipynb`](models/german-credit-basic/notebooks/deploy_webservices.ipynb) - Shows how to deploy the trained model to an Azure Container Instance\n1. For deployment to AKS, make sure to create an AKS cluster in AML that has `SSL enabled` (using the Microsoft certificate)\n\n### MLOps demo part\n\n#### Simple MLOps pipelines\n\n1. Create a new project in Azure DevOps\n1. Fork this repo or import it into Azure DevOps (so that you can make changes to the repo)\n1. Create a service connection to your Azure Machine Learning workspace and use the name `aml-workspace-connection`\n1. Edit [`pipelines/german-credit-config.yml`](pipelines/german-credit-config.yml) and adapt the values to point to your workspace\n1. Import the following pipelines into DevOps\n    * [`pipelines/german-credit-train-and-register.yml`](pipelines/german-credit-train-and-register.yml) - Trains and registers the model automatically\n    * [`pipelines/german-credit-deploy.yml`](pipelines/german-credit-deploy.yml) - Deploys the trained model to AKS\n1. Run the pipelines\n\n#### Staged MLOps pipelines\n\n1. First, get the simple pipelines from [`pipelines/`](pipelines/) running\n1. Edit [`pipelines-staged/german-credit-config-dev.yml`](pipelines-staged/german-credit-config-dev.yml) and  [`pipelines-staged/german-credit-config-prod.yml`](pipelines-staged/german-credit-config-prod.yml) and adapt the values to point to your dev and prod workspaces\n1. Import the following pipeline into DevOps\n    * [`pipelines-staged/german-credit-rollout.yml`](pipelines-staged/german-credit-rollout.yml) - Trains, registers, and deploys the model automatically to a Dev environment, once successful, the same is repeated in a Prod environment\n1. Run the pipeline\n\n## Conventions\n\nThis repo is fully based on conventions in order to make MLOps reusable and easily scaleable.\nThe directory structure is as follows:\n\n```\npipelines\n    \\- german-credit-config.yml - Configuration for german credit model\n    \\- german-credit-deploy.yml - Deployment pipeline for german credit model\n    \\- german-credit-train-and-register.yml - Pipline for training and registering the base german credit model\nmodels\n    \\- model1\n        train.py (entry file for training)\n        score.py (entry file for scoring)\n        \\- config\n            deployment-config-aks.yml - Deployment infrastructure definition (e.g., AKS configuration)\n            inference-conda.yml - Conda environement definition for inferencing/scoring\n            inference-config.yml - Azure Machine Learning config for inferencing\n            train-conda.yml - Conda environement definition for training\n    \\- model2\n        ...same file and folder structure...\n```\n\n## Testing\n\nThis snipped can be used to manually showcase/test the deployed model on ACI: \n\n```python\nimport requests\nimport json\n\nurl = '\u003cscoring url\u003e'\nkey = '\u003capi key\u003e'\n\ntest_data = {\n  'data': [{\n    \"Age\": 20,\n    \"Sex\": \"male\",\n    \"Job\": 0,\n    \"Housing\": \"own\",\n    \"Saving accounts\": \"little\",\n    \"Checking account\": \"little\",\n    \"Credit amount\": 100,\n    \"Duration\": 48,\n    \"Purpose\": \"radio/TV\"\n  }]\n}\n\nheaders = {'Content-Type': 'application/json', 'Authorization': 'Bearer ' + key}\nresp = requests.post(url, json=test_data, headers=headers)\n\nprint(\"Prediction (good, bad):\", resp.text)\n```\n\n## Further Work\n\n:star: A fully documented starting template for Azure Machine Leraning with MLOps can be found here: [microsoft/aml-acceleration-template](https://github.com/microsoft/aml-acceleration-template/). This includes model training, validation, testing, deployment, pipelines, and several other production-grade capabilties.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsiebler%2Fmlops-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsiebler%2Fmlops-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsiebler%2Fmlops-demo/lists"}