From 438dd00ce2becae642c92933565b55e401c3d815 Mon Sep 17 00:00:00 2001 From: amah Date: Mon, 21 Nov 2022 12:17:26 -0800 Subject: [PATCH] Amah/update e2e sample (#1898) * updated the notebook * updated the e2e sample notebook * removed test value * linting * removed unwanted cell Co-authored-by: Ali M --- .../e2e-ds-experience/e2e-ml-workflow.ipynb | 62 +++++++++++++------ 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/tutorials/e2e-ds-experience/e2e-ml-workflow.ipynb b/tutorials/e2e-ds-experience/e2e-ml-workflow.ipynb index e254a33bd..811dc8c5c 100644 --- a/tutorials/e2e-ds-experience/e2e-ml-workflow.ipynb +++ b/tutorials/e2e-ds-experience/e2e-ml-workflow.ipynb @@ -399,7 +399,7 @@ " tags={\"scikit-learn\": \"0.24.2\"},\n", " conda_file=os.path.join(dependencies_dir, \"conda.yml\"),\n", " image=\"mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest\",\n", - " version=\"1.0\",\n", + " version=\"0.1.0\",\n", ")\n", "pipeline_job_env = ml_client.environments.create_or_update(pipeline_job_env)\n", "\n", @@ -578,7 +578,22 @@ } }, "source": [ - "Optionally, register the component in the workspace for future re-use." + "Optionally, register the component in the workspace for future re-use. **command()** is a component builder, in order to fetch the component itself, we need to call the **.component** property from it." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Now we register the component to the workspace\n", + "data_prep_component = ml_client.create_or_update(data_prep_component.component)\n", + "\n", + "# Create (register) the component in your workspace\n", + "print(\n", + " f\"Component {data_prep_component.name} with Version {data_prep_component.version} is registered\"\n", + ")" ] }, { @@ -589,7 +604,7 @@ "\n", "The second component that you'll create will consume the training and test data, train a tree based model and return the output model. You'll use Azure ML logging capabilities to record and visualize the learning progress.\n", "\n", - "You used the `command` class to create your first component. This time you'll use the yaml definition to define the second component. Each method has its own advantages. A yaml definition can actually be checked-in along the code, and would provide a readable history tracking. The programmatic method using `command` can be easier with built-in class documentation and code completion.\n", + "You used the `command` class to create your first component. This time you'll use the yaml definition to define the second component. Each method has its own advantages. A yaml definition can actually be checked-in along the code, and would provide a readable history tracking. Also, the same yaml file can be used in the CLI for component deficnition. The programmatic method using `command` can be easier with built-in class documentation and code completion.\n", "\n", "\n", "Create the directory for this component:" @@ -954,10 +969,9 @@ "\n", "# Let's instantiate the pipeline with the parameters of our choice\n", "pipeline = credit_defaults_pipeline(\n", - " # pipeline_job_data_input=credit_data,\n", - " pipeline_job_data_input=Input(type=\"uri_file\", path=web_path),\n", - " pipeline_job_test_train_ratio=0.2,\n", - " pipeline_job_learning_rate=0.25,\n", + " pipeline_job_data_input=Input(type=\"uri_file\", path=credit_data.path),\n", + " pipeline_job_test_train_ratio=0.25,\n", + " pipeline_job_learning_rate=0.05,\n", " pipeline_job_registered_model_name=registered_model_name,\n", ")" ] @@ -999,7 +1013,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "An output of \"False\" is expected from the above cell. You can track the progress of your pipeline, by using the link generated in the cell above or in this notebook using the following code:\n", + "You can track the progress of your pipeline, by using the link generated in the cell above or in this notebook using the following code:\n", "```python\n", " ml_client.jobs.stream(pipeline_job.name)\n", "```\n", @@ -1094,9 +1108,11 @@ " },\n", ")\n", "\n", - "endpoint = ml_client.begin_create_or_update(endpoint)\n", + "endpoint_result = ml_client.begin_create_or_update(endpoint).result()\n", "\n", - "print(f\"Endpint {endpoint.name} provisioning state: {endpoint.provisioning_state}\")" + "print(\n", + " f\"Endpint {endpoint_result.name} provisioning state: {endpoint_result.provisioning_state}\"\n", + ")" ] }, { @@ -1185,11 +1201,17 @@ " name=\"blue\",\n", " endpoint_name=online_endpoint_name,\n", " model=model,\n", - " instance_type=\"Standard_DS3_v2\",\n", + " instance_type=\"Standard_F4s_v2\",\n", " instance_count=1,\n", ")\n", "\n", - "blue_deployment = ml_client.begin_create_or_update(blue_deployment)" + "blue_deployment_results = ml_client.online_deployments.begin_create_or_update(\n", + " blue_deployment\n", + ").result()\n", + "\n", + "print(\n", + " f\"Deployment {blue_deployment_results.name} provisioning state: {blue_deployment_results.provisioning_state}\"\n", + ")" ] }, { @@ -1300,13 +1322,10 @@ ], "metadata": { "celltoolbar": "Edit Metadata", - "interpreter": { - "hash": "6d65a8c07f5b6469e0fc613f182488c0dccce05038bbda39e5ac9075c0454d11" - }, "kernelspec": { - "display_name": "Python 3.8 - AzureML", + "display_name": "Python 3.8.13 ('sdkv2')", "language": "python", - "name": "python38-azureml" + "name": "python3" }, "language_info": { "codemirror_mode": { @@ -1318,12 +1337,17 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.7" + "version": "3.8.13" }, "nteract": { "version": "nteract-front-end@1.0.0" + }, + "vscode": { + "interpreter": { + "hash": "78d13900fb236b5ce4c0b952de9b1270f1802c447ee20a989ea10ffd935aa825" + } } }, "nbformat": 4, "nbformat_minor": 1 -} \ No newline at end of file +}