• Latest
  • Trending
MLOps on AWS using MLflow

MLOps on AWS using MLflow

January 3, 2022
Inaugural AfCFTA Conference on Women and Youth in Trade

Inaugural AfCFTA Conference on Women and Youth in Trade

September 6, 2022
Instagram fined €405m over children’s data privacy

Instagram fined €405m over children’s data privacy

September 6, 2022
8 Most Common Causes of a Data Breach

5.7bn data entries found exposed on Chinese VPN

August 18, 2022
Fibre optic interconnection linking Cameroon and Congo now operational

Fibre optic interconnection linking Cameroon and Congo now operational

July 15, 2022
Ericsson and MTN Rwandacell Discuss their Long-Term Partnership

Ericsson and MTN Rwandacell Discuss their Long-Term Partnership

July 15, 2022
Airtel Africa Purchases $42M Worth of Additional Spectrum

Airtel Africa Purchases $42M Worth of Additional Spectrum

July 15, 2022
Huawei steps up drive for Kenyan talent

Huawei steps up drive for Kenyan talent

July 15, 2022
TSMC predicts Q3 revenue boost thanks to increased iPhone 13 demand

TSMC predicts Q3 revenue boost thanks to increased iPhone 13 demand

July 15, 2022
Facebook to allow up to five profiles tied to one account

Facebook to allow up to five profiles tied to one account

July 15, 2022
Top 10 apps built and managed in Ghana

Top 10 apps built and managed in Ghana

July 15, 2022
MTN Group to Host the 2nd Edition of the MoMo API Hackathon

MTN Group to Host the 2nd Edition of the MoMo API Hackathon

July 15, 2022
KIOXIA Introduce JEDEC XFM Removable Storage with PCIe/NVMe Spec

KIOXIA Introduce JEDEC XFM Removable Storage with PCIe/NVMe Spec

July 15, 2022
  • Consumer Watch
  • Kids Page
  • Directory
  • Events
  • Reviews
Monday, 30 January, 2023
  • Login
itechnewsonline.com
  • Home
  • Tech
  • Africa Tech
  • InfoSEC
  • Data Science
  • Data Storage
  • Business
  • Opinion
Subscription
Advertise
No Result
View All Result
itechnewsonline.com
No Result
View All Result

MLOps on AWS using MLflow

by ITECHNEWS
January 3, 2022
in Data Science, Leading Stories
0 0
0
MLOps on AWS using MLflow

For any business, seamless deployment of ML models into production is the key to success of its live analytics use cases. In this article, we will learn about deploying ML models on AWS (Amazon Web Services) using MLflow and also look at different ways to productionize them. Subsequently, we will explore the same process on the two other popular platforms: Azure and GCP. Let’s begin.

MLOps on Azure, AWS and GCP

Deploying an ML model on AWS: Pre-requisites

AWS command line interface (CLI) installed and credentials configured
Once the credentials are verified, the AWS CLI allows connection to AWS workspace
An Identity and Access Management execution role defined that grants SageMaker access to the S3 buckets.
Properly installed and working docker


Once the above steps are done with, here’s how we proceed with the deployment process on AWS –

YOU MAY ALSO LIKE

Inaugural AfCFTA Conference on Women and Youth in Trade

Instagram fined €405m over children’s data privacy

1. Configuring AWS


Before any model can actually be deployed on SageMaker, Amazon workspace needs to be set up. The models can be pushed from your local mlruns directory similar to process followed during local model deployment. But it is much more convenient and centralized to have all our runs be pushed to AWS and stored in a bucket. This way, all teams can access models that are stored here.

In a sense, this acts as a “Model Registry” although it doesn’t offer the same functionality as the MLflow Model Registry. A single bucket will be sufficient to host all the MLflow runs.

From here, let’s pick a specific run and deploy it on SageMaker. To keep it simple, we will once again use the scikit-learn logistic regression model that we trained as the model we are deploying. So with that, let’s create a simple bucket and name it as per convenience, say mlflow-sagemaker. We can either create it through the AWS CLI or do so through the AWS console on your browser.

AWS management console

Click “create bucket”

create bucket on AWS management console

Here, we have named our bucket mlops-sagemaker-runs. For rest of the options, scroll down to the bottom and click Create Bucket. Once done, the created bucket can be seen in the list of buckets.

import subprocess
s3_bucket_name = “mlops-sagemaker-runs”
mlruns_direc = “./mlruns/”
output = subprocess.run([“aws”, “s3”, “sync”, “{}”.
format(mlruns_direc), “s3://{}”.format(s3_bucket_name)],
stdout=subprocess.PIPE, encoding=’utf-8′)
print(output.stdout)
print(“\nSaved to bucket: “, s3_bucket_name)

2. Deploying an ML Model to AWS SageMaker


Here, MLflow SageMaker module code can be used to push a model to SageMaker. After SageMaker creates an endpoint, the model is hosted here utilizing the docker image that we pushed earlier to the ECR.

To deploy ML model on SageMaker, we will need to gather app_name, model_uri , execution_role, region and image_ecr_url.

SageMaker will be used to host the model once you get to deployment. To do that, the following command can be run in the terminal:

Now, a new container in the portal can be seen as we navigate to Amazon ECR.

import boto3
import mlflow.sagemaker as mfs
import json
app_name = “mlops-sagemaker”
execution_role_arn = “arn:aws:iam::180072566886:role/
service-role/
AmazonSageMaker-ExecutionRole-20181112T142060″
image_ecr_url = “180072566886.dkr.ecr.us-east-2.amazonaws.com/
mlflow-pyfunc:1.10.0″
region = “us-east-2”
s3_bucket_name = “mlops-sagemaker-runs”
experiment_id = “8”
run_id = “1eb809b446d949d5a70a1e22e4b4f428”
model_name = “log_reg_model”
model_uri = “s3://{}/{}/{}/artifacts/{}/”.format
(s3_bucket_name, experiment_id, run_id, model_name)

This will set up all of the parameters that you will use to run the deployment code.

Now, let’s look at the code for deployment:

mfs.deploy(app_name=app_name,
model_uri=model_uri,
execution_role_arn=execution_role_arn,
region_name=region,
image_url=image_ecr_url,
mode=mfs.DEPLOYMENT_MODE_CREATE)

3. Making predictions


Once the model has been deployed and is ready to serve, we can use Boto3 to query the model and receive predictions.

4. Switching Models


MLflow provides functionality that enables swapping a deployed model with a new one. SageMaker essentially updates the endpoint with the new model you are trying to deploy.

MLflow provides explicit AWS SageMaker support in its operationalization code. We have seen how to upload runs to an S3 bucket and how to create and push an MLflow Docker container image for AWS SageMaker to use when operationalizing your models.

Source: Mohak Batra Associate Data Scientist
Tags: AWSMLflowMLOps
ShareTweetShare
Plugin Install : Subscribe Push Notification need OneSignal plugin to be installed.

Search

No Result
View All Result

Recent News

Inaugural AfCFTA Conference on Women and Youth in Trade

Inaugural AfCFTA Conference on Women and Youth in Trade

September 6, 2022
Instagram fined €405m over children’s data privacy

Instagram fined €405m over children’s data privacy

September 6, 2022
8 Most Common Causes of a Data Breach

5.7bn data entries found exposed on Chinese VPN

August 18, 2022

About What We Do

itechnewsonline.com

We bring you the best Premium Tech News.

Recent News With Image

Inaugural AfCFTA Conference on Women and Youth in Trade

Inaugural AfCFTA Conference on Women and Youth in Trade

September 6, 2022
Instagram fined €405m over children’s data privacy

Instagram fined €405m over children’s data privacy

September 6, 2022

Recent News

  • Inaugural AfCFTA Conference on Women and Youth in Trade September 6, 2022
  • Instagram fined €405m over children’s data privacy September 6, 2022
  • 5.7bn data entries found exposed on Chinese VPN August 18, 2022
  • Fibre optic interconnection linking Cameroon and Congo now operational July 15, 2022
  • Home
  • InfoSec
  • Opinion
  • Africa Tech
  • Data Storage

© 2021-2022 iTechNewsOnline.Com - Powered by BackUPDataSystems

No Result
View All Result
  • Home
  • Tech
  • Africa Tech
  • InfoSEC
  • Data Science
  • Data Storage
  • Business
  • Opinion

© 2021-2022 iTechNewsOnline.Com - Powered by BackUPDataSystems

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Go to mobile version