{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "459beb39-74fd-4b26-bcb3-6758a0457211", "metadata": {}, "source": [ "# Bedrock onboarding notebook\n", "\n", "This notebook provides steps requried to install Bedrock SDK, dependencies and other pre-requisistes before API calls can be made.\n", "It also provides sample code to access LLMs, text to image, embeddings and streaming support\n", "\n", "(This notebook was tested on SageMaker Studio ml.m5.2xlarge instance with Datascience 3.0 kernel)\n" ] }, { "attachments": {}, "cell_type": "markdown", "id": "9a084890-68ea-4276-805e-51213dfe9f2d", "metadata": {}, "source": [ "## Pre-requisites" ] }, { "cell_type": "code", "execution_count": null, "id": "a6a4a622-dd13-413a-beca-ab48dd1fb9c9", "metadata": { "tags": [] }, "outputs": [], "source": [ "#Check Python version is greater than 3.8 which is required by Langchain if you want to use Langchain\n", "import sys\n", "sys.version" ] }, { "cell_type": "code", "execution_count": null, "id": "9ee8d3fd-ec6b-4288-a69e-5d349eb7e585", "metadata": { "tags": [] }, "outputs": [], "source": [ "assert sys.version_info >= (3, 8)" ] }, { "attachments": {}, "cell_type": "markdown", "id": "25361ade-216a-4c60-ba2e-5fae622d1441", "metadata": {}, "source": [ "## Step 1 - Copy the documentation/SDK folder" ] }, { "cell_type": "code", "execution_count": null, "id": "55ca182e-5d8a-4468-a679-8ad5d7556bdb", "metadata": { "scrolled": true, "tags": [] }, "outputs": [], "source": [ "!aws s3 cp s3://amazon-bedrock-limited-preview-documents/Documentation/ ./bedrock_docs --recursive" ] }, { "attachments": {}, "cell_type": "markdown", "id": "915d8544-7a65-4427-9705-5668762c2259", "metadata": { "tags": [] }, "source": [ "## Step 2 - Install the SDK" ] }, { "attachments": {}, "cell_type": "markdown", "id": "a4f5ffeb-992a-4961-ba39-3adb30d3bef0", "metadata": {}, "source": [ "#### Unzip the SDK - this may take some time" ] }, { "cell_type": "code", "execution_count": null, "id": "9676054a-4bbb-4186-b6d4-2274339ac430", "metadata": { "tags": [] }, "outputs": [], "source": [ "!unzip -o bedrock_docs/SDK/bedrock-python-sdk.zip -d bedrock_docs/SDK" ] }, { "attachments": {}, "cell_type": "markdown", "id": "e285ef30-01ed-45d2-9c57-5c520af85d99", "metadata": { "tags": [] }, "source": [ "#### Install the boto3 package. This overwrites any existing boto3 installations and will not break any other calls to other services. Also, if you are running this in a notebook, you may need to restart the kernel after installation " ] }, { "cell_type": "code", "execution_count": null, "id": "1980280e-66ec-4c99-a7e8-abc8c089a17c", "metadata": { "scrolled": true, "tags": [] }, "outputs": [], "source": [ "#!pip uninstall sagemaker -y # results in install errors with latest sagemaker, and can be installed later" ] }, { "cell_type": "code", "execution_count": null, "id": "390c0101-0109-4878-9649-2c95840de3ad", "metadata": { "tags": [] }, "outputs": [], "source": [ "!python3 -m pip install bedrock_docs/SDK/boto3-1.26.162-py3-none-any.whl" ] }, { "cell_type": "code", "execution_count": null, "id": "e9c2e83d-f0aa-484e-bd35-5f572af920cb", "metadata": { "tags": [] }, "outputs": [], "source": [ "!python3 -m pip install bedrock_docs/SDK/botocore-1.29.162-py3-none-any.whl" ] }, { "cell_type": "code", "execution_count": null, "id": "a430219a-fe71-4663-9dab-d6cc40a6d70b", "metadata": { "tags": [] }, "outputs": [], "source": [ " # Optional, for the CLI:\n", "#!python3 -m pip install bedrock_docs/SDK/awscli-1.27.162-py3-none-any.whl" ] }, { "attachments": {}, "cell_type": "markdown", "id": "e58c8978-512a-4ae0-869f-0df2e5bf6369", "metadata": {}, "source": [ "### Verify boto3 installation" ] }, { "cell_type": "code", "execution_count": null, "id": "406fe9ee-ecc9-41d3-8165-80a263726e8f", "metadata": { "tags": [] }, "outputs": [], "source": [ "#!aws bedrock list-foundation-models \n", "!aws --version" ] }, { "cell_type": "code", "execution_count": null, "id": "177d2bcf-e4f6-4eb6-a2d0-0450382102bc", "metadata": { "tags": [] }, "outputs": [], "source": [ "#Check if boto3 is installed & get the install location\n", "!pip show boto3" ] }, { "cell_type": "code", "execution_count": null, "id": "924d4d47-3c03-47a9-bd9e-b6b92c3d9e92", "metadata": { "tags": [] }, "outputs": [], "source": [ "!ls /opt/conda/lib/python3.10/site-packages/botocore/data | grep bedrock" ] }, { "attachments": {}, "cell_type": "markdown", "id": "611f0c05-d786-42f8-a9e9-be7e0645fc7f", "metadata": {}, "source": [ "## Restart Kernel" ] }, { "cell_type": "code", "execution_count": null, "id": "faddcd08-8c69-45e2-9058-22d5552ba19c", "metadata": { "tags": [] }, "outputs": [], "source": [ "import IPython\n", "app = IPython.Application.instance()\n", "app.kernel.do_shutdown(True) " ] }, { "attachments": {}, "cell_type": "markdown", "id": "325bbdc9-f496-4cf0-948e-d5bdd30cd105", "metadata": {}, "source": [ "## Step 3- Attach policies to IAM role to permission Bedrock service" ] }, { "cell_type": "code", "execution_count": null, "id": "2ceb6433-b5ee-456c-b291-e65696ea7478", "metadata": {}, "outputs": [], "source": [ "import sagemaker\n", "import boto3\n", "session = boto3.Session()\n", "sagemaker_session = sagemaker.Session()\n", "studio_region = sagemaker_session.boto_region_name \n", "#sagemaker_session.get_caller_identity_arn()" ] }, { "attachments": {}, "cell_type": "markdown", "id": "250331e0-dec6-45df-b9b2-dd2968530a56", "metadata": { "tags": [] }, "source": [ "First add a policy to the role listed above similar to:\n", " \n", "```\n", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Sid\": \"Bedrock\",\n", " \"Effect\": \"Allow\",\n", " \"Action\": \"bedrock:*\",\n", " \"Resource\": \"*\"\n", " }\n", " ]\n", "}\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "id": "9848798d-ac21-4f2d-9686-537e61693533", "metadata": {}, "source": [ "## Step 4 - Test bedrock boto3 install" ] }, { "cell_type": "code", "execution_count": null, "id": "6ed7347b-ac00-4d1a-adae-188b43920264", "metadata": { "tags": [] }, "outputs": [], "source": [ "# Configure your AWS credentials using the aws configure command, or pass them to the boto3 client\n", "bedrock = boto3.client('bedrock' , 'us-east-1', endpoint_url='https://bedrock.us-east-1.amazonaws.com')\n", "bedrock.list_foundation_models()" ] }, { "cell_type": "code", "execution_count": null, "id": "7a508d59-ca1e-4fd2-abd5-132222d340d3", "metadata": { "tags": [] }, "outputs": [], "source": [ "[m['modelId'] for m in bedrock.list_foundation_models()['modelSummaries']]" ] }, { "attachments": {}, "cell_type": "markdown", "id": "5df343be-53bf-431b-bf43-8acf78477399", "metadata": {}, "source": [ "## Step 5- Test Foundation models " ] }, { "cell_type": "code", "execution_count": null, "id": "fc75a9f9-acaa-4702-bac2-8cbf6add0a47", "metadata": { "tags": [] }, "outputs": [], "source": [ "import json\n", "prompt_data = \"\"\"Command: Write me a blog about making strong business decisions as a leader.\\nBlog:\"\"\"" ] }, { "attachments": {}, "cell_type": "markdown", "id": "f064a2ed-3d1e-4248-ab8d-6a55281432be", "metadata": {}, "source": [ "### Evaluate Titan Large" ] }, { "cell_type": "code", "execution_count": null, "id": "a072ab46-1e2f-4c5b-bfee-480d6e185e84", "metadata": { "tags": [] }, "outputs": [], "source": [ "body = json.dumps({\"inputText\": prompt_data})\n", "modelId = \"amazon.titan-tg1-large\" \n", "accept = \"application/json\"\n", "contentType = \"application/json\"\n", "\n", "response = bedrock.invoke_model(\n", " body=body, modelId=modelId, accept=accept, contentType=contentType\n", ")\n", "response_body = json.loads(response.get(\"body\").read())\n", "\n", "print(response_body.get(\"results\")[0].get(\"outputText\"))" ] }, { "attachments": {}, "cell_type": "markdown", "id": "7332274c-9b16-4a48-ac76-41ffdb4cf878", "metadata": {}, "source": [ "### Evaluate Anthropic Claude Instant" ] }, { "cell_type": "code", "execution_count": null, "id": "7535c5d0-08fa-4cc0-8a15-a3cccb092608", "metadata": { "tags": [] }, "outputs": [], "source": [ "body = json.dumps({\"prompt\": prompt_data, \"max_tokens_to_sample\": 500})\n", "modelId = \"anthropic.claude-instant-v1\" \n", "accept = \"application/json\"\n", "contentType = \"application/json\"\n", "\n", "response = bedrock.invoke_model(\n", " body=body, modelId=modelId, accept=accept, contentType=contentType\n", ")\n", "response_body = json.loads(response.get(\"body\").read())\n", "\n", "print(response_body.get(\"completion\"))" ] }, { "attachments": {}, "cell_type": "markdown", "id": "7a90b206-380a-4000-b9de-d7e376c65bc4", "metadata": {}, "source": [ "### Evaluate AI21 Jurassic Grande" ] }, { "cell_type": "code", "execution_count": null, "id": "863baadd-79f4-4491-9658-fa017870b424", "metadata": { "tags": [] }, "outputs": [], "source": [ "body = json.dumps({\"prompt\": prompt_data, \"maxTokens\": 200})\n", "modelId = \"ai21.j2-grande-instruct\" # change this to use a different version from the model provider\n", "accept = \"application/json\"\n", "contentType = \"application/json\"\n", "\n", "response = bedrock.invoke_model(\n", " body=body, modelId=modelId, accept=accept, contentType=contentType\n", ")\n", "response_body = json.loads(response.get(\"body\").read())\n", "\n", "print(response_body.get(\"completions\")[0].get(\"data\").get(\"text\"))" ] }, { "attachments": {}, "cell_type": "markdown", "id": "e9a712b4-c30a-4b9b-bd2d-754aa5ec8d8a", "metadata": {}, "source": [ "### Evaluate Titan Embeddings" ] }, { "cell_type": "code", "execution_count": null, "id": "c8524f43-9375-44eb-af92-0ce18b995208", "metadata": { "tags": [] }, "outputs": [], "source": [ "body = json.dumps({\"inputText\": prompt_data})\n", "modelId = \"amazon.titan-e1t-medium\" \n", "accept = \"application/json\"\n", "contentType = \"application/json\"\n", "\n", "response = bedrock.invoke_model(\n", " body=body, modelId=modelId, accept=accept, contentType=contentType\n", ")\n", "response_body = json.loads(response.get(\"body\").read())\n", "\n", "embedding = response_body.get(\"embedding\")\n", "print(f\"The embedding vector has {len(embedding)} values\\n{embedding[0:3]+['...']+embedding[-3:]}\")" ] }, { "attachments": {}, "cell_type": "markdown", "id": "d060ef80-fa17-4963-97a7-e1d5af1a991c", "metadata": {}, "source": [ "### Evaluate Stable Diffusion Model" ] }, { "cell_type": "code", "execution_count": null, "id": "95ecb148-68f5-41ff-933f-07fe42cab57e", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt_data = \"a fine image of an astronaut riding a horse on Mars\"\n", "body = json.dumps({\n", " \"text_prompts\": [\n", " { \n", " \"text\": prompt_data \n", " }\n", " ],\n", " \"cfg_scale\":10,\n", " \"seed\":20,\n", " \"steps\":50\n", "})\n", "modelId = \"stability.stable-diffusion-xl\" \n", "accept = \"application/json\"\n", "contentType = \"application/json\"\n", "\n", "response = bedrock.invoke_model(\n", " body=body, modelId=modelId, accept=accept, contentType=contentType\n", ")\n", "response_body = json.loads(response.get(\"body\").read())\n", "\n", "print(response_body['result'])\n", "print(f'{response_body.get(\"artifacts\")[0].get(\"base64\")[0:80]}...')" ] }, { "cell_type": "code", "execution_count": null, "id": "a5f3b0a7-d295-4011-b8d6-590e3e94480e", "metadata": { "tags": [] }, "outputs": [], "source": [ "import io, base64\n", "from matplotlib.pyplot import imshow\n", "from PIL import Image\n", "base_64_img_str = response_body.get(\"artifacts\")[0].get(\"base64\")\n", "image = Image.open(io.BytesIO(base64.decodebytes(bytes(base_64_img_str, \"utf-8\"))))\n", "imshow(image)" ] }, { "attachments": {}, "cell_type": "markdown", "id": "295d4ca3-c2eb-4e43-a62e-b13658c2e106", "metadata": {}, "source": [ "### Streaming Response" ] }, { "cell_type": "code", "execution_count": null, "id": "ece233c0-b092-4381-860c-07a47b988c3b", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt_data = \"\"\"Command: Write me a blog about making strong business decisions as a leader.\\nBlog:\"\"\"\n", "from IPython.display import display, display_markdown, Markdown, clear_output\n", "\n", "body = json.dumps({\"prompt\": prompt_data, \"max_tokens_to_sample\": 200})\n", "modelId = \"anthropic.claude-instant-v1\" \n", "accept = \"application/json\"\n", "contentType = \"application/json\"\n", "\n", "response = bedrock.invoke_model_with_response_stream(body=body, modelId=modelId, accept=accept, contentType=contentType)\n", "stream = response.get('body')\n", "output = []\n", "\n", "if stream:\n", " for event in stream:\n", " chunk = event.get('chunk')\n", " if chunk:\n", " chunk_obj = json.loads(chunk.get('bytes').decode())\n", " text = chunk_obj['completion']\n", " clear_output(wait=True)\n", " output.append(text)\n", " display_markdown(Markdown(''.join(output)))" ] }, { "cell_type": "code", "execution_count": null, "id": "c53b424f-29c5-4beb-b8f1-2e738a8f7d78", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "availableInstances": [ { "_defaultOrder": 0, "_isFastLaunch": true, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 4, "name": "ml.t3.medium", "vcpuNum": 2 }, { "_defaultOrder": 1, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 8, "name": "ml.t3.large", "vcpuNum": 2 }, { "_defaultOrder": 2, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.t3.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 3, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.t3.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 4, "_isFastLaunch": true, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 8, "name": "ml.m5.large", "vcpuNum": 2 }, { "_defaultOrder": 5, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.m5.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 6, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.m5.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 7, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 64, "name": "ml.m5.4xlarge", "vcpuNum": 16 }, { "_defaultOrder": 8, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 128, "name": "ml.m5.8xlarge", "vcpuNum": 32 }, { "_defaultOrder": 9, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 192, "name": "ml.m5.12xlarge", "vcpuNum": 48 }, { "_defaultOrder": 10, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 256, "name": "ml.m5.16xlarge", "vcpuNum": 64 }, { "_defaultOrder": 11, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 384, "name": "ml.m5.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 12, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 8, "name": "ml.m5d.large", "vcpuNum": 2 }, { "_defaultOrder": 13, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.m5d.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 14, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.m5d.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 15, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 64, "name": "ml.m5d.4xlarge", "vcpuNum": 16 }, { "_defaultOrder": 16, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 128, "name": "ml.m5d.8xlarge", "vcpuNum": 32 }, { "_defaultOrder": 17, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 192, "name": "ml.m5d.12xlarge", "vcpuNum": 48 }, { "_defaultOrder": 18, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 256, "name": "ml.m5d.16xlarge", "vcpuNum": 64 }, { "_defaultOrder": 19, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 384, "name": "ml.m5d.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 20, "_isFastLaunch": false, "category": "General purpose", "gpuNum": 0, "hideHardwareSpecs": true, "memoryGiB": 0, "name": "ml.geospatial.interactive", "supportedImageNames": [ "sagemaker-geospatial-v1-0" ], "vcpuNum": 0 }, { "_defaultOrder": 21, "_isFastLaunch": true, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 4, "name": "ml.c5.large", "vcpuNum": 2 }, { "_defaultOrder": 22, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 8, "name": "ml.c5.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 23, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.c5.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 24, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.c5.4xlarge", "vcpuNum": 16 }, { "_defaultOrder": 25, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 72, "name": "ml.c5.9xlarge", "vcpuNum": 36 }, { "_defaultOrder": 26, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 96, "name": "ml.c5.12xlarge", "vcpuNum": 48 }, { "_defaultOrder": 27, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 144, "name": "ml.c5.18xlarge", "vcpuNum": 72 }, { "_defaultOrder": 28, "_isFastLaunch": false, "category": "Compute optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 192, "name": "ml.c5.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 29, "_isFastLaunch": true, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.g4dn.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 30, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.g4dn.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 31, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 64, "name": "ml.g4dn.4xlarge", "vcpuNum": 16 }, { "_defaultOrder": 32, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 128, "name": "ml.g4dn.8xlarge", "vcpuNum": 32 }, { "_defaultOrder": 33, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 4, "hideHardwareSpecs": false, "memoryGiB": 192, "name": "ml.g4dn.12xlarge", "vcpuNum": 48 }, { "_defaultOrder": 34, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 256, "name": "ml.g4dn.16xlarge", "vcpuNum": 64 }, { "_defaultOrder": 35, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 61, "name": "ml.p3.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 36, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 4, "hideHardwareSpecs": false, "memoryGiB": 244, "name": "ml.p3.8xlarge", "vcpuNum": 32 }, { "_defaultOrder": 37, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 8, "hideHardwareSpecs": false, "memoryGiB": 488, "name": "ml.p3.16xlarge", "vcpuNum": 64 }, { "_defaultOrder": 38, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 8, "hideHardwareSpecs": false, "memoryGiB": 768, "name": "ml.p3dn.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 39, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.r5.large", "vcpuNum": 2 }, { "_defaultOrder": 40, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.r5.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 41, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 64, "name": "ml.r5.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 42, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 128, "name": "ml.r5.4xlarge", "vcpuNum": 16 }, { "_defaultOrder": 43, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 256, "name": "ml.r5.8xlarge", "vcpuNum": 32 }, { "_defaultOrder": 44, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 384, "name": "ml.r5.12xlarge", "vcpuNum": 48 }, { "_defaultOrder": 45, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 512, "name": "ml.r5.16xlarge", "vcpuNum": 64 }, { "_defaultOrder": 46, "_isFastLaunch": false, "category": "Memory Optimized", "gpuNum": 0, "hideHardwareSpecs": false, "memoryGiB": 768, "name": "ml.r5.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 47, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 16, "name": "ml.g5.xlarge", "vcpuNum": 4 }, { "_defaultOrder": 48, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 32, "name": "ml.g5.2xlarge", "vcpuNum": 8 }, { "_defaultOrder": 49, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 64, "name": "ml.g5.4xlarge", "vcpuNum": 16 }, { "_defaultOrder": 50, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 128, "name": "ml.g5.8xlarge", "vcpuNum": 32 }, { "_defaultOrder": 51, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 1, "hideHardwareSpecs": false, "memoryGiB": 256, "name": "ml.g5.16xlarge", "vcpuNum": 64 }, { "_defaultOrder": 52, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 4, "hideHardwareSpecs": false, "memoryGiB": 192, "name": "ml.g5.12xlarge", "vcpuNum": 48 }, { "_defaultOrder": 53, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 4, "hideHardwareSpecs": false, "memoryGiB": 384, "name": "ml.g5.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 54, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 8, "hideHardwareSpecs": false, "memoryGiB": 768, "name": "ml.g5.48xlarge", "vcpuNum": 192 }, { "_defaultOrder": 55, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 8, "hideHardwareSpecs": false, "memoryGiB": 1152, "name": "ml.p4d.24xlarge", "vcpuNum": 96 }, { "_defaultOrder": 56, "_isFastLaunch": false, "category": "Accelerated computing", "gpuNum": 8, "hideHardwareSpecs": false, "memoryGiB": 1152, "name": "ml.p4de.24xlarge", "vcpuNum": 96 } ], "instance_type": "ml.m5.2xlarge", "kernelspec": { "display_name": "Python 3 (Data Science 3.0)", "language": "python", "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-1:081325390199:image/sagemaker-data-science-310-v1" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.6" } }, "nbformat": 4, "nbformat_minor": 5 }