Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update samples from Release-193 as a part of 1.53.0 SDK stable release #1935

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Azure Machine Learning Python SDK notebooks


** **With the introduction of AzureML SDK v2, this samples repository for the v1 SDK is now deprecated and will not be monitored or updated. Users are encouraged to visit the [v2 SDK samples repository](https://github.com/Azure/azureml-examples) instead for up-to-date and enhanced examples of how to build, train, and deploy machine learning models with AzureML's newest features.** **

> a community-driven repository of examples using mlflow for tracking can be found at https://github.com/Azure/azureml-examples

Welcome to the Azure Machine Learning Python SDK notebooks repository!

Expand Down
4 changes: 2 additions & 2 deletions configuration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"source": [
"import azureml.core\n",
"\n",
"print(\"This notebook was created using version 1.51.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.53.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down Expand Up @@ -329,7 +329,7 @@
" print(\"Creating new gpu-cluster\")\n",
" \n",
" # Specify the configuration for the new cluster\n",
" compute_config = AmlCompute.provisioning_configuration(vm_size=\"STANDARD_NC6\",\n",
" compute_config = AmlCompute.provisioning_configuration(vm_size=\"Standard_NC6s_v3\",\n",
" min_nodes=0,\n",
" max_nodes=4)\n",
" # Create the cluster with the specified name and configuration\n",
Expand Down
2 changes: 1 addition & 1 deletion contrib/RAPIDS/azure-ml-with-nvidia-rapids.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
"else:\n",
" print(\"creating new cluster\")\n",
" # vm_size parameter below could be modified to one of the RAPIDS-supported VM types\n",
" provisioning_config = AmlCompute.provisioning_configuration(vm_size = \"Standard_NC6s_v2\", min_nodes=1, max_nodes = 1)\n",
" provisioning_config = AmlCompute.provisioning_configuration(vm_size = \"Standard_NC6s_v3\", min_nodes=1, max_nodes = 1)\n",
"\n",
" # create the cluster\n",
" gpu_cluster = ComputeTarget.create(ws, gpu_cluster_name, provisioning_config)\n",
Expand Down
4 changes: 2 additions & 2 deletions contrib/fairness/fairlearn-azureml-mitigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ dependencies:
- pip:
- azureml-sdk
- azureml-contrib-fairness
- fairlearn>=0.6.2
- fairlearn>=0.6.2,<=0.7.0
- joblib
- liac-arff
- raiwidgets~=0.26.0
- raiwidgets~=0.28.0
- itsdangerous==2.0.1
- markupsafe<2.1.0
- protobuf==3.20.0
Expand Down
4 changes: 2 additions & 2 deletions contrib/fairness/upload-fairness-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ dependencies:
- pip:
- azureml-sdk
- azureml-contrib-fairness
- fairlearn>=0.6.2
- fairlearn>=0.6.2,<=0.7.0
- joblib
- liac-arff
- raiwidgets~=0.26.0
- raiwidgets~=0.28.0
- itsdangerous==2.0.1
- markupsafe<2.1.0
- protobuf==3.20.0
Expand Down
11 changes: 6 additions & 5 deletions how-to-use-azureml/automated-machine-learning/automl_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ dependencies:
# The python interpreter version.
# Azure ML only supports 3.7.0 and later.
- pip==22.3.1
- python>=3.7,<3.9
- python>=3.8,<3.9
- holidays==0.10.3
- conda-forge::fbprophet==0.7.1
- pandas==1.1.5
- scipy==1.5.3
Expand All @@ -16,10 +17,10 @@ dependencies:

- pip:
# Required packages for AzureML execution, history, and data preparation.
- azureml-widgets~=1.51.0
- azureml-defaults~=1.51.0
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.51.0/validated_win32_requirements.txt [--no-deps]
- matplotlib==3.6.2
- azureml-widgets~=1.53.0
- azureml-defaults~=1.53.0
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.53.0/validated_win32_requirements.txt [--no-deps]
- matplotlib==3.7.1
- xgboost==1.3.3
- cmdstanpy==0.9.5
- setuptools-git==1.2
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ dependencies:
# The python interpreter version.
# Azure ML only supports 3.7 and later.
- pip==22.3.1
- python>=3.7,<3.9
- matplotlib==3.2.1
- python>=3.8,<3.9
- matplotlib==3.7.1
- numpy>=1.21.6,<=1.22.3
- cython==0.29.14
- urllib3==1.26.7
- scipy>=1.4.1,<=1.5.3
- scikit-learn==0.22.1
- scikit-learn==1.1.0
- py-xgboost<=1.3.3
- holidays==0.10.3
- conda-forge::fbprophet==0.7.1
Expand All @@ -23,10 +23,10 @@ dependencies:

- pip:
# Required packages for AzureML execution, history, and data preparation.
- azureml-widgets~=1.51.0
- azureml-defaults~=1.51.0
- azureml-widgets~=1.53.0
- azureml-defaults~=1.53.0
- pytorch-transformers==1.0.0
- spacy==2.2.4
- pystan==2.19.1.1
- 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.51.0/validated_linux_requirements.txt [--no-deps]
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.53.0/validated_linux_requirements.txt [--no-deps]
18 changes: 7 additions & 11 deletions how-to-use-azureml/automated-machine-learning/automl_env_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ dependencies:
# The python interpreter version.
# Currently Azure ML only supports 3.7 and later.
- pip==22.3.1
- python>=3.7,<3.9
- matplotlib==3.2.1
- python>=3.8,<3.9
- numpy>=1.21.6,<=1.22.3
- cython==0.29.14
- urllib3==1.26.7
- scipy>=1.4.1,<=1.5.3
- scikit-learn==0.22.1
- py-xgboost<=1.3.3
- scikit-learn==1.1.0
- holidays==0.10.3
- pytorch::pytorch=1.11.0
- cudatoolkit=9.0
- notebook

- pip:
# Required packages for AzureML execution, history, and data preparation.
- azureml-widgets~=1.51.0
- azureml-defaults~=1.51.0
- azureml-widgets~=1.53.0
- azureml-defaults~=1.53.0
- pytorch-transformers==1.0.0
- spacy==2.2.4
- pystan==2.19.1.1
- fbprophet==0.7.1
- xgboost==1.3.3
- matplotlib==3.7.1
- 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.51.0/validated_darwin_requirements.txt [--no-deps]
- -r https://automlsdkdataresources.blob.core.windows.net/validated-requirements/1.53.0/validated_darwin_requirements.txt [--no-deps]
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{
"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/automated-machine-learning/classification-bank-marketing-all-features/auto-ml-classification-bank-marketing-all-features.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -830,9 +846,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"%matplotlib notebook\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{
"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/automated-machine-learning/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{
"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/automated-machine-learning/classification-text-dnn/auto-ml-classification-text-dnn.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -139,8 +155,8 @@
" print(\"Found existing cluster, use it.\")\n",
"except ComputeTargetException:\n",
" compute_config = AmlCompute.provisioning_configuration(\n",
" vm_size=\"STANDARD_NC6\", # CPU for BiLSTM, such as \"STANDARD_D2_V2\"\n",
" # To use BERT (this is recommended for best performance), select a GPU such as \"STANDARD_NC6\"\n",
" vm_size=\"Standard_NC6s_v3\", # CPU for BiLSTM, such as \"STANDARD_D2_V2\"\n",
" # To use BERT (this is recommended for best performance), select a GPU such as \"Standard_NC6s_v3\"\n",
" # or similar GPU option\n",
" # available in your workspace\n",
" idle_seconds_before_scaledown=60,\n",
Expand Down Expand Up @@ -336,7 +352,7 @@
"metadata": {},
"source": [
"For local inferencing, you can load the model locally via. the method `remote_run.get_output()`. For more information on the arguments expected by this method, you can run `remote_run.get_output??`.\n",
"Note that when the model contains BERT, this step will require pytorch and pytorch-transformers installed in your local environment. The exact versions of these packages can be found in the **automl_env.yml** file located in the local copy of your azureml-examples folder here: \"azureml-examples/python-sdk/tutorials/automl-with-azureml\""
"Note that when the model contains BERT, this step will require pytorch and pytorch-transformers installed in your local environment. The exact versions of these packages can be found in the **automl_env.yml** file located in the local copy of your MachineLearningNotebooks folder here: \"MachineLearningNotebooks\\how-to-use-azureml\\automated-machine-learning\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import pandas as pd
from azureml.core import Environment, ScriptRunConfig
from azureml.core.run import Run
Expand All @@ -13,7 +14,16 @@ def run_inference(
model_name,
):

inference_env = train_run.get_environment()
try:
inference_env = train_run.get_environment()
except BaseException:
run_details = train_run.get_details()
run_def = run_details.get("runDefinition")
env = run_def.get("environment")
if env is None:
raise
json.dump(env, open("azureml_environment.json", "w"))
inference_env = Environment.load_from_directory(".")

est = ScriptRunConfig(
source_directory=script_folder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pandas as pd
import numpy as np

from sklearn.externals import joblib
import joblib

from azureml.automl.runtime.shared.score import scoring, constants
from azureml.core import Run, Dataset
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
{
"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/automated-machine-learning/continuous-retraining/auto-ml-continuous-retraining.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
model = Model(ws, args.model_name)
last_train_time = model.created_time
print("Model was last trained on {0}.".format(last_train_time))
except Exception as e:
except Exception:
print("Could not get last model train time.")
last_train_time = datetime.min.replace(tzinfo=pytz.UTC)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.51.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.53.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.51.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.53.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
name: azure_automl_experimental
dependencies:
# The python interpreter version.
<<<<<<< HEAD
# Currently Azure ML only supports 3.6.0 and later.
- pip<=20.2.4
- python>=3.6.0,<3.10
- cython==0.29.14
- urllib3==1.26.7
- PyJWT < 2.0.0
- numpy==1.22.3
- pywin32==227
- cryptography<37.0.0
=======
# Currently Azure ML only supports 3.7.0 and later.
- pip<=22.3.1
- python>=3.7.0,<3.11
>>>>>>> 4671acd451ce979c3cebcd3917804861a333b710

- pip:
# Required packages for AzureML execution, history, and data preparation.
Expand All @@ -25,4 +13,3 @@ dependencies:
- azureml-mlflow
- pandas
- mlflow
- docker<6.0.0
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.51.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.53.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"metadata": {},
"outputs": [],
"source": [
"print(\"This notebook was created using version 1.51.0 of the Azure ML SDK\")\n",
"print(\"This notebook was created using version 1.53.0 of the Azure ML SDK\")\n",
"print(\"You are currently using version\", azureml.core.VERSION, \"of the Azure ML SDK\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/forecasting-hierarchical-timeseries/auto-ml-forecasting-hierarchical-timeseries.png)"
"![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/forecasting-backtest-many-models/auto-ml-forecasting-backtest-many-models.png)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Copyright (c) Microsoft Corporation. All rights reserved.\n",
"\n",
"Licensed under the MIT License.\n",
"![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/automl-forecasting-function.png)"
"![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/auto-ml-forecasting-backtest-single-model.png)"
]
},
{
Expand Down
Loading