Skip to content

Instantly share code, notes, and snippets.

@jeanmidevacc
Last active January 3, 2020 21:24
Show Gist options
  • Save jeanmidevacc/aec48590b80cc97c5019b267891550b0 to your computer and use it in GitHub Desktop.
Save jeanmidevacc/aec48590b80cc97c5019b267891550b0 to your computer and use it in GitHub Desktop.
import mlflow.sagemaker as mfs
# Define mlflow parameter
experimentid = 1
runid = "xxxxxxx"
# AWS setup
awsid = "xxxxxx"# id of the AWS user that will deploy the system
region "xxxxx" # AWS region to deploy the API
arn = f"arn:aws:iam::{awsid}:role/xxxxx" # Arn of the role that will be used to do the deployment on sagemaker
# Give a nae ot the app
app_name = "xxxxxx" # Name of the app that will be deployed
# Setup the path for the deployment
model_uri = f"mlruns/{experimentid}/{runid}/artifacts/model"
image_url = awsid + ".dkr.ecr." + region + ".amazonaws.com/mlflow-pyfunc:1.4.0" #import tant to give the right version mlfloe deploy in ECR
# Deploy it
mfs.deploy(app_name = app_name,
model_uri = model_uri,
region_name = region,
mode = "replace", # like that you can overwrite
execution_role_arn = arn,
image_url = image_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment