From b091d1f5f104bdaf565cf02f89185d058816238c Mon Sep 17 00:00:00 2001 From: Roope Astala Date: Fri, 9 Nov 2018 09:31:25 -0500 Subject: [PATCH] Update 00.configuration.ipynb Create computes in 00.configuration, and link to tutorial --- 00.configuration.ipynb | 119 ++++++++++++++++++++++++++++++++++------- 1 file changed, 100 insertions(+), 19 deletions(-) diff --git a/00.configuration.ipynb b/00.configuration.ipynb index 6e5f2e27..6cc1eb92 100644 --- a/00.configuration.ipynb +++ b/00.configuration.ipynb @@ -101,11 +101,20 @@ "metadata": {}, "outputs": [], "source": [ - "from azureml.core import Workspace\n", + "import os\n", "\n", - "subscription_id =''\n", - "resource_group =''\n", - "workspace_name = ''\n", + "subscription_id = os.environ.get(\"SUBSCRIPTION_ID\", \"\")\n", + "resource_group = os.environ.get(\"RESOURCE_GROUP\", \"\")\n", + "workspace_name = os.environ.get(\"WORKSPACE_NAME\", \"\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from azureml.core import Workspace\n", "\n", "try:\n", " ws = Workspace(subscription_id = subscription_id, resource_group = resource_group, workspace_name = workspace_name)\n", @@ -142,15 +151,6 @@ "Specify a region where your workspace will be located from the list of [Azure Machine Learning regions](https://linktoregions)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "workspace_region = \"eastus2\"" - ] - }, { "cell_type": "code", "execution_count": null, @@ -159,10 +159,11 @@ "source": [ "import os\n", "\n", - "subscription_id = os.environ.get(\"SUBSCRIPTION_ID\", subscription_id)\n", - "resource_group = os.environ.get(\"RESOURCE_GROUP\", resource_group)\n", - "workspace_name = os.environ.get(\"WORKSPACE_NAME\", workspace_name)\n", - "workspace_region = os.environ.get(\"WORKSPACE_REGION\", workspace_region)" + "subscription_id = os.environ.get(\"SUBSCRIPTION_ID\", \"\")\n", + "resource_group = os.environ.get(\"RESOURCE_GROUP\", \"my-aml-resource-group\")\n", + "workspace_name = os.environ.get(\"WORKSPACE_NAME\", \"my-first-workspace\")\n", + "\n", + "workspace_region = os.environ.get(\"WORKSPACE_REGION\", \"eastus2\")" ] }, { @@ -207,12 +208,92 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Success!\n", - "Great, you are ready to move on to the rest of the sample notebooks." + "## Create compute resources for your training experiments\n", + "\n", + "Many of the subsequent examples use BatchAI clusters to train models at scale. To create a **CPU** cluster now, run the cell below. The autoscale settings mean that the cluster will scale down to 0 nodes when inactive and up to 8 nodes when busy." ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from azureml.core.compute import ComputeTarget, BatchAiCompute\n", + "from azureml.core.compute_target import ComputeTargetException\n", + "\n", + "# Choose a name for your CPU cluster\n", + "cpu_cluster_name = \"cpucluster\"\n", + "\n", + "# Verify that cluster does not exist already\n", + "try:\n", + " cpu_cluster = ComputeTarget(workspace=ws, name=cpu_cluster_name)\n", + " print('Found existing cluster, use it.')\n", + "except ComputeTargetException:\n", + " compute_config = BatchAiCompute.provisioning_configuration(vm_size='STANDARD_D2_V2', \n", + " autoscale_enabled=True,\n", + " cluster_min_nodes=0, \n", + " cluster_max_nodes=6)\n", + " cpu_cluster = ComputeTarget.create(ws, cpu_cluster_name, compute_config)\n", + "\n", + "cpu_cluster.wait_for_completion(show_output=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To create a **GPU** cluster, run the cell below. Note that your subscription must have sufficient quota for GPU VMs or the command will fail. To increase quota, see [these instructions](https://docs.microsoft.com/en-us/azure/azure-supportability/resource-manager-core-quotas-request). " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from azureml.core.compute import ComputeTarget, BatchAiCompute\n", + "from azureml.core.compute_target import ComputeTargetException\n", + "\n", + "# Choose a name for your GPU cluster\n", + "gpu_cluster_name = \"gpucluster\"\n", + "\n", + "# Check if cluster exists already\n", + "try:\n", + " gpu_cluster = ComputeTarget(workspace=ws, name=gpu_cluster_name)\n", + " print('Found existing cluster, use it.')\n", + "except ComputeTargetException:\n", + " compute_config = BatchAiCompute.provisioning_configuration(vm_size='STANDARD_NC6', \n", + " autoscale_enabled=True,\n", + " cluster_min_nodes=0, \n", + " cluster_max_nodes=6)\n", + " gpu_cluster = ComputeTarget.create(ws, gpu_cluster_name, compute_config)\n", + "\n", + "gpu_cluster.wait_for_completion(show_output=True)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Success!\n", + "Great, you are ready to move on to the rest of the sample notebooks. A good place to start is the [01.train-model tutorial](./tutorials/01.train-model.ipynb) to learn how to train and then deploy an image classification model." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { + "authors": [ + { + "name": "roastala" + } + ], "kernelspec": { "display_name": "Python 3.6", "language": "python",