Compare commits

..

1 Commits

Author SHA1 Message Date
amlrelsa-ms
68d6108ef6 update samples from Release-174 as a part of SDK release 2023-03-27 21:00:27 +00:00
29 changed files with 451 additions and 48 deletions

View File

@@ -103,7 +103,7 @@
"source": [ "source": [
"import azureml.core\n", "import azureml.core\n",
"\n", "\n",
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -6,7 +6,7 @@ dependencies:
- fairlearn>=0.6.2 - fairlearn>=0.6.2
- joblib - joblib
- liac-arff - liac-arff
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0
- protobuf==3.20.0 - protobuf==3.20.0

View File

@@ -6,7 +6,7 @@ dependencies:
- fairlearn>=0.6.2 - fairlearn>=0.6.2
- joblib - joblib
- liac-arff - liac-arff
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0
- protobuf==3.20.0 - protobuf==3.20.0

View File

@@ -16,9 +16,9 @@ dependencies:
- pip: - pip:
# Required packages for AzureML execution, history, and data preparation. # Required packages for AzureML execution, history, and data preparation.
- azureml-widgets~=1.50.0 - azureml-widgets~=Latest
- azureml-defaults~=1.50.0 - azureml-defaults~=Latest
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.50.0/validated_win32_requirements.txt [--no-deps] - -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/Latest/validated_win32_requirements.txt [--no-deps]
- matplotlib==3.6.2 - matplotlib==3.6.2
- xgboost==1.3.3 - xgboost==1.3.3
- cmdstanpy==0.9.5 - cmdstanpy==0.9.5

View File

@@ -23,10 +23,10 @@ dependencies:
- pip: - pip:
# Required packages for AzureML execution, history, and data preparation. # Required packages for AzureML execution, history, and data preparation.
- azureml-widgets~=1.50.0 - azureml-widgets~=Latest
- azureml-defaults~=1.50.0 - azureml-defaults~=Latest
- pytorch-transformers==1.0.0 - pytorch-transformers==1.0.0
- spacy==2.2.4 - spacy==2.2.4
- pystan==2.19.1.1 - pystan==2.19.1.1
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz - https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.50.0/validated_linux_requirements.txt [--no-deps] - -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/Latest/validated_linux_requirements.txt [--no-deps]

View File

@@ -23,10 +23,10 @@ dependencies:
- pip: - pip:
# Required packages for AzureML execution, history, and data preparation. # Required packages for AzureML execution, history, and data preparation.
- azureml-widgets~=1.50.0 - azureml-widgets~=Latest
- azureml-defaults~=1.50.0 - azureml-defaults~=Latest
- pytorch-transformers==1.0.0 - pytorch-transformers==1.0.0
- spacy==2.2.4 - spacy==2.2.4
- pystan==2.19.1.1 - pystan==2.19.1.1
- https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz - https://aka.ms/automl-resources/packages/en_core_web_sm-2.1.0.tar.gz
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.50.0/validated_darwin_requirements.txt [--no-deps] - -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/Latest/validated_darwin_requirements.txt [--no-deps]

View File

@@ -97,7 +97,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -97,7 +97,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -92,7 +92,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -91,7 +91,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -0,0 +1,373 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Copyright (c) Microsoft Corporation. All rights reserved.\n",
"\n",
"Licensed under the MIT License."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/deployment/production-deploy-to-aks/production-deploy-to-aks.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Deploy models to Azure Kubernetes Service (AKS) using controlled roll out\n",
"This notebook will show you how to deploy mulitple AKS webservices with the same scoring endpoint and how to roll out your models in a controlled manner by configuring % of scoring traffic going to each webservice. If you are using a Notebook VM, you are all set. Otherwise, go through the [configuration notebook](../../../configuration.ipynb) to install the Azure Machine Learning Python SDK and create an Azure ML Workspace."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Check for latest version\n",
"import azureml.core\n",
"print(azureml.core.VERSION)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Initialize workspace\n",
"Create a [Workspace](https://docs.microsoft.com/python/api/azureml-core/azureml.core.workspace%28class%29?view=azure-ml-py) object from your persisted configuration."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core.workspace import Workspace\n",
"\n",
"ws = Workspace.from_config()\n",
"print(ws.name, ws.resource_group, ws.location, ws.subscription_id, sep = '\\n')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Register the model\n",
"Register a file or folder as a model by calling [Model.register()](https://docs.microsoft.com/python/api/azureml-core/azureml.core.model.model?view=azure-ml-py#register-workspace--model-path--model-name--tags-none--properties-none--description-none--datasets-none--model-framework-none--model-framework-version-none--child-paths-none-).\n",
"In addition to the content of the model file itself, your registered model will also store model metadata -- model description, tags, and framework information -- that will be useful when managing and deploying models in your workspace. Using tags, for instance, you can categorize your models and apply filters when listing models in your workspace."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core import Model\n",
"\n",
"model = Model.register(workspace=ws,\n",
" model_name='sklearn_regression_model.pkl', # Name of the registered model in your workspace.\n",
" model_path='./sklearn_regression_model.pkl', # Local file to upload and register as a model.\n",
" model_framework=Model.Framework.SCIKITLEARN, # Framework used to create the model.\n",
" model_framework_version='0.19.1', # Version of scikit-learn used to create the model.\n",
" description='Ridge regression model to predict diabetes progression.',\n",
" tags={'area': 'diabetes', 'type': 'regression'})\n",
"\n",
"print('Name:', model.name)\n",
"print('Version:', model.version)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Register an environment (for all models)\n",
"\n",
"If you control over how your model is run, or if it has special runtime requirements, you can specify your own environment and scoring method.\n",
"\n",
"Specify the model's runtime environment by creating an [Environment](https://docs.microsoft.com/python/api/azureml-core/azureml.core.environment%28class%29?view=azure-ml-py) object and providing the [CondaDependencies](https://docs.microsoft.com/python/api/azureml-core/azureml.core.conda_dependencies.condadependencies?view=azure-ml-py) needed by your model."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core import Environment\n",
"from azureml.core.conda_dependencies import CondaDependencies\n",
"\n",
"environment=Environment('my-sklearn-environment')\n",
"environment.python.conda_dependencies = CondaDependencies.create(conda_packages=[\n",
" 'pip==20.2.4'],\n",
" pip_packages=[\n",
" 'azureml-defaults',\n",
" 'inference-schema[numpy-support]',\n",
" 'numpy==1.23',\n",
" 'scikit-learn==0.22.1',\n",
" 'scipy'\n",
"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When using a custom environment, you must also provide Python code for initializing and running your model. An example script is included with this notebook."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"with open('score.py') as f:\n",
" print(f.read())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create the InferenceConfig\n",
"Create the inference configuration to reference your environment and entry script during deployment"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core.model import InferenceConfig\n",
"\n",
"inference_config = InferenceConfig(entry_script='score.py', \n",
" source_directory='.',\n",
" environment=environment)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Provision the AKS Cluster\n",
"If you already have an AKS cluster attached to this workspace, skip the step below and provide the name of the cluster.\n",
"\n",
"> Note that if you have an AzureML Data Scientist role, you will not have permission to create compute resources. Talk to your workspace or IT admin to create the compute targets described in this section, if they do not already exist."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core.compute import AksCompute\n",
"from azureml.core.compute import ComputeTarget\n",
"# Use the default configuration (can also provide parameters to customize)\n",
"prov_config = AksCompute.provisioning_configuration()\n",
"\n",
"aks_name = 'my-aks' \n",
"# Create the cluster\n",
"aks_target = ComputeTarget.create(workspace = ws, \n",
" name = aks_name, \n",
" provisioning_configuration = prov_config) \n",
"aks_target.wait_for_completion(show_output=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create an Endpoint and add a version (AKS service)\n",
"This creates a new endpoint and adds a version behind it. By default the first version added is the default version. You can specify the traffic percentile a version takes behind an endpoint. \n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# deploying the model and create a new endpoint\n",
"from azureml.core.webservice import AksEndpoint\n",
"# from azureml.core.compute import ComputeTarget\n",
"\n",
"#select a created compute\n",
"compute = ComputeTarget(ws, 'my-aks')\n",
"namespace_name=\"endpointnamespace\"\n",
"# define the endpoint name\n",
"endpoint_name = \"myendpoint1\"\n",
"# define the service name\n",
"version_name= \"versiona\"\n",
"\n",
"endpoint_deployment_config = AksEndpoint.deploy_configuration(tags = {'modelVersion':'firstversion', 'department':'finance'}, \n",
" description = \"my first version\", namespace = namespace_name, \n",
" version_name = version_name, traffic_percentile = 40)\n",
"\n",
"endpoint = Model.deploy(ws, endpoint_name, [model], inference_config, endpoint_deployment_config, compute)\n",
"endpoint.wait_for_deployment(True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"endpoint.get_logs()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Add another version of the service to an existing endpoint\n",
"This adds another version behind an existing endpoint. You can specify the traffic percentile the new version takes. If no traffic_percentile is specified then it defaults to 0. All the unspecified traffic percentile (in this example 50) across all versions goes to default version."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Adding a new version to an existing Endpoint.\n",
"version_name_add=\"versionb\" \n",
"\n",
"endpoint.create_version(version_name = version_name_add, inference_config=inference_config, models=[model], tags = {'modelVersion':'secondversion', 'department':'finance'}, \n",
" description = \"my second version\", traffic_percentile = 10)\n",
"endpoint.wait_for_deployment(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Update an existing version in an endpoint\n",
"There are two types of versions: control and treatment. An endpoint contains one or more treatment versions but only one control version. This categorization helps compare the different versions against the defined control version."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"endpoint.update_version(version_name=endpoint.versions[version_name_add].name, description=\"my second version update\", traffic_percentile=40, is_default=True, is_control_version_type=True)\n",
"endpoint.wait_for_deployment(True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test the web service using run method\n",
"Test the web sevice by passing in data. Run() method retrieves API keys behind the scenes to make sure that call is authenticated."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Scoring on endpoint\n",
"import json\n",
"test_sample = json.dumps({'data': [\n",
" [1,2,3,4,5,6,7,8,9,10], \n",
" [10,9,8,7,6,5,4,3,2,1]\n",
"]})\n",
"\n",
"test_sample_encoded = bytes(test_sample, encoding='utf8')\n",
"prediction = endpoint.run(input_data=test_sample_encoded)\n",
"print(prediction)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Delete Resources"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# deleting a version in an endpoint\n",
"endpoint.delete_version(version_name=version_name)\n",
"endpoint.wait_for_deployment(True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# deleting an endpoint, this will delete all versions in the endpoint and the endpoint itself\n",
"endpoint.delete()"
]
}
],
"metadata": {
"authors": [
{
"name": "shipatel"
}
],
"category": "deployment",
"compute": [
"None"
],
"datasets": [
"Diabetes"
],
"deployment": [
"Azure Kubernetes Service"
],
"exclude_from_index": false,
"framework": [
"Scikit-learn"
],
"friendly_name": "Deploy models to AKS using controlled roll out",
"index_order": 3,
"kernelspec": {
"display_name": "Python 3.8 - AzureML",
"language": "python",
"name": "python38-azureml"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
},
"star_tag": [
"featured"
],
"tags": [
"None"
],
"task": "Deploy a model with Azure Machine Learning"
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@@ -0,0 +1,4 @@
name: deploy-aks-with-controlled-rollout
dependencies:
- pip:
- azureml-sdk

View File

@@ -0,0 +1,28 @@
import pickle
import json
import numpy
from sklearn.externals import joblib
from sklearn.linear_model import Ridge
from azureml.core.model import Model
def init():
global model
# note here "sklearn_regression_model.pkl" is the name of the model registered under
# this is a different behavior than before when the code is run locally, even though the code is the same.
model_path = Model.get_model_path('sklearn_regression_model.pkl')
# deserialize the model file back into a sklearn model
model = joblib.load(model_path)
# note you can pass in multiple rows for scoring
def run(raw_data):
try:
data = json.loads(raw_data)['data']
data = numpy.array(data)
result = model.predict(data)
# you can return any data type as long as it is JSON-serializable
return result.tolist()
except Exception as e:
error = str(e)
return error

View File

@@ -106,7 +106,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -10,7 +10,7 @@ dependencies:
- ipython - ipython
- matplotlib - matplotlib
- ipywidgets - ipywidgets
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0
- scipy>=1.5.3 - scipy>=1.5.3

View File

@@ -10,7 +10,7 @@ dependencies:
- matplotlib - matplotlib
- azureml-dataset-runtime - azureml-dataset-runtime
- ipywidgets - ipywidgets
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0
- scipy>=1.5.3 - scipy>=1.5.3

View File

@@ -9,7 +9,7 @@ dependencies:
- ipython - ipython
- matplotlib - matplotlib
- ipywidgets - ipywidgets
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- packaging>=20.9 - packaging>=20.9
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0

View File

@@ -9,7 +9,7 @@ dependencies:
- ipython - ipython
- matplotlib - matplotlib
- ipywidgets - ipywidgets
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- packaging>=20.9 - packaging>=20.9
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0

View File

@@ -11,7 +11,7 @@ dependencies:
- azureml-dataset-runtime - azureml-dataset-runtime
- azureml-core - azureml-core
- ipywidgets - ipywidgets
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- itsdangerous==2.0.1 - itsdangerous==2.0.1
- markupsafe<2.1.0 - markupsafe<2.1.0
- scipy>=1.5.3 - scipy>=1.5.3

View File

@@ -175,7 +175,7 @@
"store_name=os.getenv(\"ADL_STORENAME_62\", \"<my-datastore-name>\") # ADLS account name\n", "store_name=os.getenv(\"ADL_STORENAME_62\", \"<my-datastore-name>\") # ADLS account name\n",
"tenant_id=os.getenv(\"ADL_TENANT_62\", \"<my-tenant-id>\") # tenant id of service principal\n", "tenant_id=os.getenv(\"ADL_TENANT_62\", \"<my-tenant-id>\") # tenant id of service principal\n",
"client_id=os.getenv(\"ADL_CLIENTID_62\", \"<my-client-id>\") # client id of service principal\n", "client_id=os.getenv(\"ADL_CLIENTID_62\", \"<my-client-id>\") # client id of service principal\n",
"client_st=os.getenv(\"ADL_CLIENT_SECRET_62\", \"<my-client-secret>\") # the secret of service principal\n", "client_secret=os.getenv(\"ADL_CLIENT_SECRET_62\", \"<my-client-secret>\") # the secret of service principal\n",
"\n", "\n",
"try:\n", "try:\n",
" adls_datastore = Datastore.get(ws, datastore_name)\n", " adls_datastore = Datastore.get(ws, datastore_name)\n",
@@ -189,7 +189,7 @@
" store_name=store_name, # ADLS account name\n", " store_name=store_name, # ADLS account name\n",
" tenant_id=tenant_id, # tenant id of service principal\n", " tenant_id=tenant_id, # tenant id of service principal\n",
" client_id=client_id, # client id of service principal\n", " client_id=client_id, # client id of service principal\n",
" client_secret=client_st) # the secret of service principal\n", " client_secret=client_secret) # the secret of service principal\n",
" print(\"Registered datastore with name: %s\" % datastore_name)\n", " print(\"Registered datastore with name: %s\" % datastore_name)\n",
"\n", "\n",
"adls_data_ref = DataReference(\n", "adls_data_ref = DataReference(\n",

View File

@@ -147,7 +147,7 @@
"store_name = os.getenv(\"ADL_STORENAME_62\", \"<my-datastore-name>\") # ADLS account name\n", "store_name = os.getenv(\"ADL_STORENAME_62\", \"<my-datastore-name>\") # ADLS account name\n",
"tenant_id = os.getenv(\"ADL_TENANT_62\", \"<my-tenant-id>\") # tenant id of service principal\n", "tenant_id = os.getenv(\"ADL_TENANT_62\", \"<my-tenant-id>\") # tenant id of service principal\n",
"client_id = os.getenv(\"ADL_CLIENTID_62\", \"<my-client-id>\") # client id of service principal\n", "client_id = os.getenv(\"ADL_CLIENTID_62\", \"<my-client-id>\") # client id of service principal\n",
"client_st = os.getenv(\"ADL_CLIENT_62_SECRET\", \"<my-client-secret>\") # the secret of service principal\n", "client_secret = os.getenv(\"ADL_CLIENT_62_SECRET\", \"<my-client-secret>\") # the secret of service principal\n",
"\n", "\n",
"try:\n", "try:\n",
" adls_datastore = Datastore.get(ws, datastore_name)\n", " adls_datastore = Datastore.get(ws, datastore_name)\n",
@@ -161,7 +161,7 @@
" store_name=store_name, # ADLS account name\n", " store_name=store_name, # ADLS account name\n",
" tenant_id=tenant_id, # tenant id of service principal\n", " tenant_id=tenant_id, # tenant id of service principal\n",
" client_id=client_id, # client id of service principal\n", " client_id=client_id, # client id of service principal\n",
" client_secret=client_st) # the secret of service principal\n", " client_secret=client_secret) # the secret of service principal\n",
" print(\"registered datastore with name: %s\" % datastore_name)" " print(\"registered datastore with name: %s\" % datastore_name)"
] ]
}, },

View File

@@ -8,11 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
rm -rf /usr/share/man/* rm -rf /usr/share/man/*
RUN conda install -y conda=23.1.0 python=3.8 && conda clean -ay RUN conda install -y conda=23.1.0 python=3.7 && conda clean -ay
RUN conda install -y -c conda-forge ffmpeg=4.0.2
# RUN conda install -c anaconda opencv
RUN pip install ray-on-aml==0.2.1 & \ RUN pip install ray-on-aml==0.2.1 & \
pip install --no-cache-dir \ pip install --no-cache-dir \
azureml-defaults \ azureml-defaults \
@@ -22,19 +18,21 @@ RUN pip install ray-on-aml==0.2.1 & \
scipy \ scipy \
pyglet==1.5.27 \ pyglet==1.5.27 \
cloudpickle==1.3.0 \ cloudpickle==1.3.0 \
tensorboard==2.7.0 \ tensorboardX \
tensorflow==2.7.0 \ tensorflow==1.14.0 \
tabulate \ tabulate \
dm_tree \ dm_tree \
lz4 \ lz4 \
psutil \ psutil \
setproctitle \ setproctitle \
pygame \ pygame \
gym[classic_control]==0.19.0 gym[classic_control]==0.19.0 && \
conda install -y -c conda-forge x264='1!152.20180717' ffmpeg=4.0.2 && \
conda install -c anaconda opencv
RUN pip install protobuf==3.20.0 RUN pip install protobuf==3.20.0
RUN pip install --upgrade ray==0.8.7 \ RUN pip install --upgrade ray==0.8.3 \
ray[rllib,dashboard,tune]==0.8.7 ray[rllib,dashboard,tune]==0.8.3
RUN pip install 'msrest<0.7.0' RUN pip install 'msrest<0.7.0'

View File

@@ -8,7 +8,7 @@ dependencies:
- matplotlib - matplotlib
- azureml-dataset-runtime - azureml-dataset-runtime
- ipywidgets - ipywidgets
- raiwidgets~=0.26.0 - raiwidgets~=0.24.0
- liac-arff - liac-arff
- packaging>=20.9 - packaging>=20.9
- itsdangerous==2.0.1 - itsdangerous==2.0.1

View File

@@ -101,7 +101,7 @@
"\n", "\n",
"# Check core SDK version number\n", "# Check core SDK version number\n",
"\n", "\n",
"print(\"This notebook was created using SDK version 1.50.0, you are currently running version\", azureml.core.VERSION)" "print(\"This notebook was created using SDK version Latest, you are currently running version\", azureml.core.VERSION)"
] ]
}, },
{ {

View File

@@ -87,6 +87,7 @@ Machine Learning notebook samples and encourage efficient retrieval of topics an
| [Deploy MNIST digit recognition with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-inference-mnist-deploy.ipynb) | Image Classification | MNIST | Local | Azure Container Instance | ONNX | ONNX Model Zoo | | [Deploy MNIST digit recognition with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-inference-mnist-deploy.ipynb) | Image Classification | MNIST | Local | Azure Container Instance | ONNX | ONNX Model Zoo |
| [Deploy Facial Expression Recognition (FER+) with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-inference-facial-expression-recognition-deploy.ipynb) | Facial Expression Recognition | Emotion FER | Local | Azure Container Instance | ONNX | ONNX Model Zoo | | [Deploy Facial Expression Recognition (FER+) with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-inference-facial-expression-recognition-deploy.ipynb) | Facial Expression Recognition | Emotion FER | Local | Azure Container Instance | ONNX | ONNX Model Zoo |
| :star:[Register model and deploy as webservice](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/deploy-to-cloud/model-register-and-deploy.ipynb) | Deploy a model with Azure Machine Learning | Diabetes | None | Azure Container Instance | Scikit-learn | None | | :star:[Register model and deploy as webservice](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/deploy-to-cloud/model-register-and-deploy.ipynb) | Deploy a model with Azure Machine Learning | Diabetes | None | Azure Container Instance | Scikit-learn | None |
| :star:[Deploy models to AKS using controlled roll out](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/deploy-with-controlled-rollout/deploy-aks-with-controlled-rollout.ipynb) | Deploy a model with Azure Machine Learning | Diabetes | None | Azure Kubernetes Service | Scikit-learn | None |
| [Train MNIST in PyTorch, convert, and deploy with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-train-pytorch-aml-deploy-mnist.ipynb) | Image Classification | MNIST | AML Compute | Azure Container Instance | ONNX | ONNX Converter | | [Train MNIST in PyTorch, convert, and deploy with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-train-pytorch-aml-deploy-mnist.ipynb) | Image Classification | MNIST | AML Compute | Azure Container Instance | ONNX | ONNX Converter |
| [Deploy ResNet50 with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-modelzoo-aml-deploy-resnet50.ipynb) | Image Classification | ImageNet | Local | Azure Container Instance | ONNX | ONNX Model Zoo | | [Deploy ResNet50 with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-modelzoo-aml-deploy-resnet50.ipynb) | Image Classification | ImageNet | Local | Azure Container Instance | ONNX | ONNX Model Zoo |
| :star:[Convert and deploy TinyYolo with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-convert-aml-deploy-tinyyolo.ipynb) | Object Detection | PASCAL VOC | local | Azure Container Instance | ONNX | ONNX Converter | | :star:[Convert and deploy TinyYolo with ONNX Runtime](https://github.com/Azure/MachineLearningNotebooks/blob/master//how-to-use-azureml/deployment/onnx/onnx-convert-aml-deploy-tinyyolo.ipynb) | Object Detection | PASCAL VOC | local | Azure Container Instance | ONNX | ONNX Converter |

View File

@@ -102,7 +102,7 @@
"source": [ "source": [
"import azureml.core\n", "import azureml.core\n",
"\n", "\n",
"print(\"This notebook was created using version 1.50.0 of the Azure ML SDK\")\n", "print(\"This notebook was created using version Latest of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")" "print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
] ]
}, },

View File

@@ -16,7 +16,6 @@ import tf_slim
from azureml.core import Run from azureml.core import Run
from azureml.core.model import Model from azureml.core.model import Model
from azureml.core.dataset import Dataset from azureml.core.dataset import Dataset
from tf_slim import nets
slim = tf_slim slim = tf_slim
@@ -42,14 +41,15 @@ def init():
parser.add_argument('--model_name', dest="model_name", required=True) parser.add_argument('--model_name', dest="model_name", required=True)
parser.add_argument('--labels_dir', dest="labels_dir", required=True) parser.add_argument('--labels_dir', dest="labels_dir", required=True)
args, _ = parser.parse_known_args() args, _ = parser.parse_known_args()
from nets import inception_v3, inception_utils
label_dict = get_class_label_dict(args.labels_dir) label_dict = get_class_label_dict(args.labels_dir)
classes_num = len(label_dict) classes_num = len(label_dict)
tf.disable_v2_behavior() tf.disable_v2_behavior()
with slim.arg_scope(nets.inception.inception_v3_arg_scope()): with slim.arg_scope(inception_utils.inception_arg_scope()):
input_images = tf.placeholder(tf.float32, [1, image_size, image_size, num_channel]) input_images = tf.placeholder(tf.float32, [1, image_size, image_size, num_channel])
logits, _ = nets.inception.inception_v3(input_images, logits, _ = inception_v3.inception_v3(input_images,
num_classes=classes_num, num_classes=classes_num,
is_training=False) is_training=False)
probabilities = tf.argmax(logits, 1) probabilities = tf.argmax(logits, 1)
config = tf.ConfigProto() config = tf.ConfigProto()

View File

@@ -307,10 +307,9 @@
"\n", "\n",
"cd = CondaDependencies.create(python_version=\"3.8\",\n", "cd = CondaDependencies.create(python_version=\"3.8\",\n",
" conda_packages=['pip==20.2.4'],\n", " conda_packages=['pip==20.2.4'],\n",
" pip_packages=[\"tensorflow-gpu==2.6.0\",\n", " pip_packages=[\"tensorflow-gpu==2.3.0\",\n",
" \"tf_slim==1.1.0\", \"protobuf==3.20.1\",\n", " \"tf_slim==1.1.0\", \"protobuf==3.20.1\",\n",
" \"typing-extensions==4.3.0\",\n", " \"azureml-core\", \"azureml-dataset-runtime[fuse]\"])\n",
" \"azureml-core\", \"mltable\"])\n",
"\n", "\n",
"env = Environment(name=\"parallelenv\")\n", "env = Environment(name=\"parallelenv\")\n",
"env.python.conda_dependencies=cd\n", "env.python.conda_dependencies=cd\n",