From feb9ddf71126ba7237655226c7895314edf8dd6b Mon Sep 17 00:00:00 2001 From: jeff-shepherd <39775772+jeff-shepherd@users.noreply.github.com> Date: Thu, 12 Oct 2023 18:10:56 -0700 Subject: [PATCH] Jeffshep/fixbankmarketing (#2728) Fix the automl-classification-task-bankmarketing.ipynb sample notebook to work in the case were a new curated environment is being tested. --- ...ml-classification-task-bankmarketing.ipynb | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sdk/python/jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/automl-classification-task-bankmarketing.ipynb b/sdk/python/jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/automl-classification-task-bankmarketing.ipynb index 98c48c5457..ec99e3c3a6 100644 --- a/sdk/python/jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/automl-classification-task-bankmarketing.ipynb +++ b/sdk/python/jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/automl-classification-task-bankmarketing.ipynb @@ -77,6 +77,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "gather": { "logged": 1634852261744 }, @@ -256,6 +257,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "gather": { "logged": 1634852262026 }, @@ -314,6 +316,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "collapsed": false, "gather": { "logged": 1634852267930 }, @@ -936,6 +939,26 @@ "print(\"Artifacts: {}\".format(os.listdir(local_path)))" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Find the curated environment used for training\n", + "\n", + "import yaml\n", + "\n", + "model_file = os.path.join(local_dir, \"outputs\", \"mlflow-model\", \"MLmodel\")\n", + "\n", + "with open(model_file, \"r\") as model_stream:\n", + " model_yaml = yaml.safe_load(model_stream)\n", + " training_environment_name = (\n", + " \"AzureML-AutoML:\" + model_yaml[\"metadata\"][\"azureml.base_image\"].split(\":\")[-1]\n", + " )\n", + " print(\"Training emvironment {}\".format(training_environment_name))" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -955,7 +978,7 @@ " code=\"./artifact_downloads/outputs/generated_code/\",\n", " command=command_str,\n", " tags=dict(automl_child_run_id=best_run.info.run_id),\n", - " environment=\"AzureML-AutoML@latest\",\n", + " environment=training_environment_name,\n", " compute=compute_name,\n", " experiment_name=exp_name,\n", ")\n",