From 75e2f36eceff44b5da710daef80365c50e5ea7cc Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Tue, 13 Sep 2022 15:16:17 -0700 Subject: [PATCH] Add ContainerConfig example comment to ir notebooks --- .../inference-recommender.ipynb | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/sagemaker-inference-recommender/inference-recommender.ipynb b/sagemaker-inference-recommender/inference-recommender.ipynb index 95eb54c7e8..427094b56a 100644 --- a/sagemaker-inference-recommender/inference-recommender.ipynb +++ b/sagemaker-inference-recommender/inference-recommender.ipynb @@ -607,6 +607,54 @@ "sm_client.describe_model_package(ModelPackageName=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": {},