Skip to content

Commit

Permalink
Force reuild env (#2844)
Browse files Browse the repository at this point in the history
* Force reuild env

* Name the environment

* Fix line ending

* Add temporary fix to the notebook

* Modify conda file using YAML
  • Loading branch information
nick863 authored Nov 17, 2023
1 parent 1df37f8 commit 21f1726
Showing 1 changed file with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@
"source": [
"model_name_str = \"ojmodel\"\n",
"\n",
"\n",
"# Define pipeline\n",
"@pipeline(\n",
" description=\"AutoML Forecasting Pipeline\",\n",
Expand Down Expand Up @@ -644,7 +645,32 @@
"metadata": {},
"source": [
"## 3.1 Get Inference Pipeline Environment\n",
"This environment can be created using the `yaml` file, which we have downloaded with other best run's artifacts into the `artifact_downloads` directory."
"This environment can be created using the `yaml` file, which we have downloaded with other best run's artifacts into the `artifact_downloads` directory.<br>\n",
"We will use workaround to update cmdstanpy in the conda environment file."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import yaml\n",
"\n",
"conda_path = os.path.join(\"artifact_downloads\", \"outputs\", \"conda_env_v_1_0_0.yml\")\n",
"with open(conda_path, \"r\") as f:\n",
" dependencies = yaml.safe_load(f)\n",
"dependencies[\"dependencies\"][1][\"pip\"].append(\"cmdstanpy==1.2.0\")\n",
"conda_updated = os.path.join(\"artifact_downloads\", \"outputs\", \"conda_updated.yml\")\n",
"with open(conda_updated, \"w\") as f:\n",
" yaml.dump(dependencies, f)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Filally, load the modified environment."
]
},
{
Expand All @@ -656,9 +682,10 @@
"from azure.ai.ml.entities import Environment\n",
"\n",
"env = Environment(\n",
" name=\"oj-inference-env\",\n",
" description=\"environment for automl inference\",\n",
" image=\"mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest\",\n",
" conda_file=os.path.join(\"artifact_downloads\", \"outputs\", \"conda_env_v_1_0_0.yml\"),\n",
" conda_file=conda_updated,\n",
")"
]
},
Expand All @@ -683,6 +710,8 @@
"outputs": [],
"source": [
"output_ds_name = \"oj-output\"\n",
"\n",
"\n",
"# Define inference pipeline\n",
"@pipeline(\n",
" description=\"AutoML Inference Pipeline\",\n",
Expand Down

0 comments on commit 21f1726

Please sign in to comment.