Skip to content

Commit

Permalink
add containerConfig md and handle missing variantName
Browse files Browse the repository at this point in the history
  • Loading branch information
gwang111 committed Sep 14, 2022
1 parent 9821cde commit 50457fb
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)"
]
},
Expand Down
6 changes: 4 additions & 2 deletions sagemaker-inference-recommender/inference-recommender.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)\n",
"df.head()"
]
Expand Down Expand Up @@ -876,7 +877,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)\n",
"df.head()"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)"
]
},
Expand Down Expand Up @@ -788,7 +789,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)\n",
"df.head()"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)\n",
"df.head()"
]
Expand Down Expand Up @@ -826,7 +827,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)\n",
"df.head()"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,54 @@
"print(\"ModelPackage Version ARN : {}\".format(model_package_arn))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Alternative Option: ContainerConfig\n",
"\n",
"If you are missing mandatory fields to create an inference recommender job in your model package version like so (this `create_model_package_input_dict` is missing `Domain`, `Task`, and `SamplePayloadUrl`):\n",
"\n",
"```\n",
"create_model_package_input_dict = {\n",
" \"ModelPackageGroupName\": model_package_group_name,\n",
" \"ModelPackageDescription\": model_package_description,\n",
" \"ModelApprovalStatus\": model_approval_status,\n",
"}\n",
"```\n",
"\n",
"You may define the fields `Domain`, `Task`, and `SamplePayloadUrl` in the optional field `ContainerConfig` like so:\n",
"\n",
"```\n",
"payload_config = {\n",
" \"SamplePayloadUrl\": sample_payload_url,\n",
"}\n",
"\n",
"container_config = {\n",
" \"Domain\": ml_domain.upper(),\n",
" \"Task\": ml_task.upper(),\n",
" \"PayloadConfig\": payload_config,\n",
"}\n",
"```\n",
"\n",
"And then provide it directly within `create_inference_recommendations_job()` API like so:\n",
"\n",
"```\n",
"default_response = client.create_inference_recommendations_job(\n",
" JobName=str(default_job),\n",
" JobDescription=\"\",\n",
" JobType=\"Default\",\n",
" RoleArn=role,\n",
" InputConfig={\n",
" \"ModelPackageVersionArn\": model_package_arn,\n",
" \"ContainerConfig\": container_config\n",
" },\n",
")\n",
"```\n",
"\n",
"For more information on what else can be provided via `ContainerConfig` please refer to the `CreateInferenceRecommendationsJob` doc here: [CreateInferenceRecommendationsJob](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateInferenceRecommendationsJob.html)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -606,7 +654,8 @@
" for x in inference_recommender_job[\"InferenceRecommendations\"]\n",
"]\n",
"df = pd.DataFrame(data)\n",
"df.drop(\"VariantName\", inplace=True, axis=1)\n",
"dropFilter = df.filter([\"VariantName\"])\n",
"df.drop(dropFilter, inplace=True, axis=1)\n",
"pd.set_option(\"max_colwidth\", 400)\n",
"df.head()"
]
Expand Down

0 comments on commit 50457fb

Please sign in to comment.