Skip to content

Commit

Permalink
adding validation for inference compute allow list (#3194)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmann committed May 19, 2024
1 parent 8742943 commit 55e4123
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,35 @@
"metadata": {},
"outputs": [],
"source": [
"import ast\n",
"\n",
"instance_type = \"Standard_NC6s_v3\"\n",
"\n",
"# Inference compute allow list that supports deployment\n",
"if \"inference_compute_allow_list\" in foundation_model.tags:\n",
" inference_computes_allow_list = ast.literal_eval(\n",
" foundation_model.tags[\"inference_compute_allow_list\"]\n",
" ) # convert string to python list\n",
" print(f\"Please create a compute from the above list - {computes_allow_list}\")\n",
"else:\n",
" inference_computes_allow_list = None\n",
" print(\"`inference_compute_allow_list` is not part of model tags\")\n",
"\n",
"# Check if the compute is in the allow listed computes\n",
"if (\n",
" inference_computes_allow_list is not None\n",
" and instance_type not in inference_computes_allow_list\n",
"):\n",
" print(\n",
" f\"`instance_type` is not in the allow listed compute. Please select a value from {inference_computes_allow_list}\"\n",
" )\n",
"\n",
"# create a deployment\n",
"demo_deployment = ManagedOnlineDeployment(\n",
" name=\"demo\",\n",
" endpoint_name=online_endpoint_name,\n",
" model=registered_model.id,\n",
" instance_type=\"Standard_E8s_v3\",\n",
" instance_type=instance_type,\n",
" instance_count=1,\n",
" liveness_probe=ProbeSettings(initial_delay=600),\n",
" request_settings=OnlineRequestSettings(request_timeout_ms=90000),\n",
Expand Down

0 comments on commit 55e4123

Please sign in to comment.