Skip to content

Commit

Permalink
switch from building inf env to using train env (#2508)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamrk04 authored Jul 28, 2023
1 parent 42b53c8 commit 29c2c70
Showing 1 changed file with 7 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,40 +555,15 @@
"metadata": {},
"outputs": [],
"source": [
"from azureml.core import Model\n",
"from azureml.train.automl.run import AutoMLRun\n",
"\n",
"model = Model(ws, model_name_str)\n",
"download_path = model.download(model_name_str, exist_ok=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"After all the files are downloaded, we can generate the run config for inference runs."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from azureml.core import Environment, RunConfiguration\n",
"from azureml.core.conda_dependencies import CondaDependencies\n",
"for step in training_pipeline_run.get_steps():\n",
" if step.properties.get(\"StepType\") == \"AutoMLStep\":\n",
" automl_run = AutoMLRun(experiment, step.id)\n",
" break\n",
"\n",
"env_file = os.path.join(download_path, \"conda_env_v_1_0_0.yml\")\n",
"inference_env = Environment(\"oj-inference-env\")\n",
"inference_env.python.conda_dependencies = CondaDependencies(\n",
" conda_dependencies_file_path=env_file\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[Optional] The enviroment can also be assessed from the training run using `get_environment()` API."
"best_run = automl_run.get_best_child()\n",
"inference_env = best_run.get_environment()"
]
},
{
Expand Down

0 comments on commit 29c2c70

Please sign in to comment.