diff --git a/sagemaker-inference-recommender/huggingface-inference-recommender/huggingface-inference-recommender.ipynb b/sagemaker-inference-recommender/huggingface-inference-recommender/huggingface-inference-recommender.ipynb index 99cc314e2e..ef3ca53449 100644 --- a/sagemaker-inference-recommender/huggingface-inference-recommender/huggingface-inference-recommender.ipynb +++ b/sagemaker-inference-recommender/huggingface-inference-recommender/huggingface-inference-recommender.ipynb @@ -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)" ] }, diff --git a/sagemaker-inference-recommender/inference-recommender.ipynb b/sagemaker-inference-recommender/inference-recommender.ipynb index 427094b56a..f493ed319c 100644 --- a/sagemaker-inference-recommender/inference-recommender.ipynb +++ b/sagemaker-inference-recommender/inference-recommender.ipynb @@ -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()" ] @@ -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()" ] diff --git a/sagemaker-inference-recommender/sklearn-inference-recommender/sklearn-inference-recommender.ipynb b/sagemaker-inference-recommender/sklearn-inference-recommender/sklearn-inference-recommender.ipynb index 5b682e8ed7..bda343d8ca 100644 --- a/sagemaker-inference-recommender/sklearn-inference-recommender/sklearn-inference-recommender.ipynb +++ b/sagemaker-inference-recommender/sklearn-inference-recommender/sklearn-inference-recommender.ipynb @@ -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)" ] }, @@ -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()" ] diff --git a/sagemaker-inference-recommender/tensorflow-cloudwatch/tf-cloudwatch-inference-recommender.ipynb b/sagemaker-inference-recommender/tensorflow-cloudwatch/tf-cloudwatch-inference-recommender.ipynb index 689a4717ec..ec97f091a0 100644 --- a/sagemaker-inference-recommender/tensorflow-cloudwatch/tf-cloudwatch-inference-recommender.ipynb +++ b/sagemaker-inference-recommender/tensorflow-cloudwatch/tf-cloudwatch-inference-recommender.ipynb @@ -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()" ] @@ -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()" ] diff --git a/sagemaker-inference-recommender/xgboost/xgboost-inference-recommender.ipynb b/sagemaker-inference-recommender/xgboost/xgboost-inference-recommender.ipynb index 3ae7e16924..a0dfe49986 100644 --- a/sagemaker-inference-recommender/xgboost/xgboost-inference-recommender.ipynb +++ b/sagemaker-inference-recommender/xgboost/xgboost-inference-recommender.ipynb @@ -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": {}, @@ -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()" ]