{ "cells": [ { "cell_type": "markdown", "id": "1463f153-71d2-480c-8565-a0adcdf2b21f", "metadata": {}, "source": [ "## In-context learning with FLAN-T5-XL " ] }, { "cell_type": "markdown", "id": "690bda67-b335-4fe3-a72a-e360249dfc28", "metadata": {}, "source": [ "#### Imports " ] }, { "cell_type": "code", "execution_count": null, "id": "28f26242-65fd-471a-b1c8-a64bc686e32e", "metadata": { "tags": [] }, "outputs": [], "source": [ "from sagemaker.predictor import Predictor\n", "from sagemaker import get_execution_role\n", "from sagemaker.model import Model\n", "from sagemaker import script_uris\n", "from sagemaker import image_uris \n", "from sagemaker import model_uris\n", "import sagemaker\n", "import logging\n", "import boto3\n", "import time\n", "import json" ] }, { "cell_type": "markdown", "id": "c3c06035-ec39-4ebd-830f-49d4c164e600", "metadata": {}, "source": [ "#### Setup essentials " ] }, { "cell_type": "code", "execution_count": null, "id": "dbe1bbc7-303f-495c-95a1-a1ae1ea39464", "metadata": { "tags": [] }, "outputs": [], "source": [ "logger = logging.getLogger('sagemaker')\n", "logger.setLevel(logging.DEBUG)\n", "logger.addHandler(logging.StreamHandler())" ] }, { "cell_type": "code", "execution_count": null, "id": "7c4be196-687a-492a-8a4e-97c5a4c5b2dd", "metadata": { "tags": [] }, "outputs": [], "source": [ "logger.info(f'Using sagemaker=={sagemaker.__version__}')\n", "logger.info(f'Using boto3=={boto3.__version__}')" ] }, { "cell_type": "code", "execution_count": null, "id": "bb8dc308-3283-4dc1-b75e-9c4bb0309a89", "metadata": { "tags": [] }, "outputs": [], "source": [ "MODEL_ID = 'huggingface-text2text-flan-t5-xl' # this is hard-coded\n", "MODEL_VERSION = '*'\n", "INSTANCE_TYPE = 'ml.p3.2xlarge'\n", "INSTANCE_COUNT = 1\n", "IMAGE_SCOPE = 'inference'\n", "MODEL_DATA_DOWNLOAD_TIMEOUT = 3600 # in seconds\n", "CONTAINER_STARTUP_HEALTH_CHECK_TIMEOUT = 3600\n", "EBS_VOLUME_SIZE = 256 # in GB\n", "CONTENT_TYPE = 'application/json'\n", "\n", "# set up roles and clients \n", "client = boto3.client('sagemaker-runtime')\n", "ROLE = get_execution_role()\n", "logger.info(f'Role => {ROLE}')" ] }, { "cell_type": "code", "execution_count": null, "id": "51be04ac-c509-47f8-bb83-537a689dc653", "metadata": { "tags": [] }, "outputs": [], "source": [ "unix_time = int(time.time())\n", "endpoint_name = f'{MODEL_ID}-{unix_time}'\n", "logger.info(f'Endpoint name: {endpoint_name}')" ] }, { "cell_type": "markdown", "id": "3d67f166-291e-47ce-8cd2-48b06840e970", "metadata": {}, "source": [ "#### I. Deploy FLAN-T5-XL out-of-the-box instruction-tuned model as a SageMaker endpoint" ] }, { "cell_type": "code", "execution_count": null, "id": "b17d8a09-28e1-4ad5-9383-c960ed79bca5", "metadata": { "tags": [] }, "outputs": [], "source": [ "deploy_image_uri = image_uris.retrieve(region=None, \n", " framework=None, \n", " image_scope=IMAGE_SCOPE, \n", " model_id=MODEL_ID, \n", " model_version=MODEL_VERSION, \n", " instance_type=INSTANCE_TYPE)\n", "logger.info(f'Deploy image URI => {deploy_image_uri}')" ] }, { "cell_type": "code", "execution_count": null, "id": "ef844c04-9864-4277-a5b2-c58d2858da29", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_uri = model_uris.retrieve(model_id=MODEL_ID, \n", " model_version=MODEL_VERSION, \n", " model_scope=IMAGE_SCOPE)\n", "logger.info(f'Model URI => {model_uri}')" ] }, { "cell_type": "code", "execution_count": null, "id": "5341f604-a2bf-4748-b8d5-8343df5322f0", "metadata": { "tags": [] }, "outputs": [], "source": [ "env = {\n", " 'SAGEMAKER_MODEL_SERVER_TIMEOUT': str(3600),\n", " 'MODEL_CACHE_ROOT': '/opt/ml/model', \n", " 'SAGEMAKER_ENV': '1',\n", " 'SAGEMAKER_SUBMIT_DIRECTORY': '/opt/ml/model/code/',\n", " 'SAGEMAKER_PROGRAM': 'inference.py',\n", " 'SAGEMAKER_MODEL_SERVER_WORKERS': '1', \n", " 'TS_DEFAULT_WORKERS_PER_MODEL': '1', \n", "}" ] }, { "cell_type": "code", "execution_count": null, "id": "c17ca807-647b-4916-844d-f89bfe2af924", "metadata": { "tags": [] }, "outputs": [], "source": [ "model = Model(image_uri=deploy_image_uri, \n", " model_data=model_uri, \n", " role=ROLE, \n", " predictor_cls=Predictor, \n", " name=endpoint_name, \n", " env=env)" ] }, { "cell_type": "code", "execution_count": null, "id": "df2669fe-c5b3-4978-8eb4-61825f5e8276", "metadata": { "tags": [] }, "outputs": [], "source": [ "%%time\n", "\n", "_ = model.deploy(initial_instance_count=INSTANCE_COUNT, \n", " instance_type=INSTANCE_TYPE, \n", " endpoint_name=endpoint_name, \n", " volume_size=EBS_VOLUME_SIZE, \n", " model_data_download_timeout=MODEL_DATA_DOWNLOAD_TIMEOUT, \n", " container_startup_health_check_timeout=CONTAINER_STARTUP_HEALTH_CHECK_TIMEOUT)" ] }, { "cell_type": "markdown", "id": "739a2e2f-b55a-432b-be5f-6f101ed89ffe", "metadata": {}, "source": [ "#### II. Invoke the SageMaker endpoint to test the deployed model for natural language understanding (NLU) and natural language generation (NLG) tasks" ] }, { "cell_type": "code", "execution_count": null, "id": "70c3a605-572c-49bd-8ffa-8851d86e255e", "metadata": { "tags": [] }, "outputs": [], "source": [ "context = \"\"\"\n", "Customer: Hi there, I'm having a problem with my iPhone.\n", "Agent: Hi! I'm sorry to hear that. What's happening?\n", "Customer: The phone is not charging properly, and the battery seems to be draining very quickly. I've tried different charging cables and power adapters, but the issue persists.\n", "Agent: Hmm, that's not good. Let's try some troubleshooting steps. Can you go to Settings, then Battery, and see if there are any apps that are using up a lot of battery life?\n", "Customer: Yes, there are some apps that are using up a lot of battery.\n", "Agent: Okay, try force quitting those apps by swiping up from the bottom of the screen and then swiping up on the app to close it.\n", "Customer: I did that, but the issue is still there.\n", "Agent: Alright, let's try resetting your iPhone's settings to their default values. This won't delete any of your data. Go to Settings, then General, then Reset, and then choose Reset All Settings.\n", "Customer: Okay, I did that. What's next?\n", "Agent: Now, let's try restarting your iPhone. Press and hold the power button until you see the \"slide to power off\" option. Slide to power off, wait a few seconds, and then turn your iPhone back on.\n", "Customer: Alright, I restarted it, but it's still not charging properly.\n", "Agent: I see. It looks like we need to run a diagnostic test on your iPhone. Please visit the nearest Apple Store or authorized service provider to get your iPhone checked out.\n", "Customer: Do I need to make an appointment?\n", "Agent: Yes, it's always best to make an appointment beforehand so you don't have to wait in line. You can make an appointment online or by calling the Apple Store or authorized service provider.\n", "Customer: Okay, will I have to pay for the repairs?\n", "Agent: That depends on whether your iPhone is covered under warranty or not. If it is, you won't have to pay anything. However, if it's not covered under warranty, you will have to pay for the repairs.\n", "Customer: How long will it take to get my iPhone back?\n", "Agent: It depends on the severity of the issue, but it usually takes 1-2 business days.\n", "Customer: Can I track the repair status online?\n", "Agent: Yes, you can track the repair status online or by calling the Apple Store or authorized service provider.\n", "Customer: Alright, thanks for your help.\n", "Agent: No problem, happy to help. Is there anything else I can assist you with?\n", "Customer: No, that's all for now.\n", "Agent: Alright, have a great day and good luck with your iPhone!\n", "\"\"\"" ] }, { "cell_type": "markdown", "id": "32db9f3e-1b84-483e-bb36-6b205ad4a51a", "metadata": {}, "source": [ "Generation configuration " ] }, { "cell_type": "code", "execution_count": null, "id": "5956c6d7-b8ee-4a89-ae62-df690444bc92", "metadata": { "tags": [] }, "outputs": [], "source": [ "MAX_LENGTH = 256\n", "NUM_RETURN_SEQUENCES = 1\n", "TOP_K = 0\n", "TOP_P = 0.7\n", "DO_SAMPLE = True " ] }, { "cell_type": "markdown", "id": "0a896590-26f1-4a75-bb6a-7636b409c5b7", "metadata": {}, "source": [ "#### A. Text Summarization " ] }, { "cell_type": "code", "execution_count": null, "id": "fe31b3cc-3258-41cc-a363-9742f6e591ba", "metadata": { "tags": [] }, "outputs": [], "source": [ "query = 'write a summary'" ] }, { "cell_type": "code", "execution_count": null, "id": "bc0b66d8-cc52-416a-8a43-c00ce5947577", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt = f'{context}\\n{query}'" ] }, { "cell_type": "code", "execution_count": null, "id": "c570a0c0-ec59-4cf6-bce4-085e2baf16fb", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = {'text_inputs': prompt, \n", " 'max_length': MAX_LENGTH, \n", " 'num_return_sequences': NUM_RETURN_SEQUENCES,\n", " 'top_k': TOP_K,\n", " 'top_p': TOP_P,\n", " 'do_sample': DO_SAMPLE}" ] }, { "cell_type": "code", "execution_count": null, "id": "73125938-8fcb-47e8-9964-886d14cce241", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = json.dumps(payload).encode('utf-8')" ] }, { "cell_type": "code", "execution_count": null, "id": "bcb4d899-e965-4f5e-9972-b882f97d5986", "metadata": { "tags": [] }, "outputs": [], "source": [ "response = client.invoke_endpoint(EndpointName=endpoint_name, \n", " ContentType=CONTENT_TYPE, \n", " Body=payload)" ] }, { "cell_type": "code", "execution_count": null, "id": "ef659ca1-b1dc-44bb-9734-fa61f2906f45", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_predictions = json.loads(response['Body'].read())\n", "generated_text = model_predictions['generated_texts'][0]\n", "logger.info(f'Response: {generated_text}')" ] }, { "cell_type": "markdown", "id": "f297221e-f7fa-4b4e-9e93-634ba647dbce", "metadata": {}, "source": [ "#### B. Abstractive Question Answering " ] }, { "cell_type": "markdown", "id": "af902e9c-7ba3-4d0e-890f-3235000208cc", "metadata": {}, "source": [ "##### Q1" ] }, { "cell_type": "code", "execution_count": null, "id": "76d4ec73-27c4-497a-930c-d83bd769f1e0", "metadata": { "tags": [] }, "outputs": [], "source": [ "query = 'What troubleshooting steps were suggested to the customer to fix their iPhone charging issue?'" ] }, { "cell_type": "code", "execution_count": null, "id": "c1dd0d38-b706-4d86-9dd1-6386ba43c677", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt = f'{context}\\n{query}'" ] }, { "cell_type": "code", "execution_count": null, "id": "900bf62b-ed96-45e3-a5be-eab38f3f9b05", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = {'text_inputs': prompt, \n", " 'max_length': MAX_LENGTH, \n", " 'num_return_sequences': NUM_RETURN_SEQUENCES,\n", " 'top_k': TOP_K,\n", " 'top_p': TOP_P,\n", " 'do_sample': DO_SAMPLE}" ] }, { "cell_type": "code", "execution_count": null, "id": "f880eb9d-5ffe-4277-89a7-db83093b9ecc", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = json.dumps(payload).encode('utf-8')" ] }, { "cell_type": "code", "execution_count": null, "id": "6bcf5934-5aea-4a90-92ce-821f89165071", "metadata": { "tags": [] }, "outputs": [], "source": [ "response = client.invoke_endpoint(EndpointName=endpoint_name, \n", " ContentType=CONTENT_TYPE, \n", " Body=payload)" ] }, { "cell_type": "code", "execution_count": null, "id": "8dccdc22-704d-4a50-9c38-034ee7cccc00", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_predictions = json.loads(response['Body'].read())\n", "generated_text = model_predictions['generated_texts'][0]\n", "logger.info(f'Response: {generated_text}')" ] }, { "cell_type": "markdown", "id": "88d7781a-2184-4583-91b0-5d925ada857b", "metadata": {}, "source": [ "Q2" ] }, { "cell_type": "code", "execution_count": null, "id": "722e1c72-5450-4efd-858e-937bc499c73c", "metadata": { "tags": [] }, "outputs": [], "source": [ "query = 'Was resetting the iPhone to its default settings able to solve the charging issue and battery drain problem?'" ] }, { "cell_type": "code", "execution_count": null, "id": "99edd573-bbc3-4468-9483-7308b809f0dc", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt = f'{context}\\n{query}'" ] }, { "cell_type": "code", "execution_count": null, "id": "46e4c6b7-b1df-4f15-9116-b80b2f5b94de", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = {'text_inputs': prompt, \n", " 'max_length': MAX_LENGTH, \n", " 'num_return_sequences': NUM_RETURN_SEQUENCES,\n", " 'top_k': TOP_K,\n", " 'top_p': TOP_P,\n", " 'do_sample': DO_SAMPLE}" ] }, { "cell_type": "code", "execution_count": null, "id": "735c23cf-ce82-4a14-8b81-d1596e8e350a", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = json.dumps(payload).encode('utf-8')" ] }, { "cell_type": "code", "execution_count": null, "id": "7a61340d-fd87-4aea-831f-06bef3f500df", "metadata": { "tags": [] }, "outputs": [], "source": [ "response = client.invoke_endpoint(EndpointName=endpoint_name, \n", " ContentType=CONTENT_TYPE, \n", " Body=payload)" ] }, { "cell_type": "code", "execution_count": null, "id": "e3784d57-bb21-4c01-b655-15a3a5b7fab4", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_predictions = json.loads(response['Body'].read())\n", "generated_text = model_predictions['generated_texts'][0]\n", "logger.info(f'Response: {generated_text}')" ] }, { "cell_type": "markdown", "id": "b668ab9a-8c0e-4668-b2ea-c53471a09569", "metadata": {}, "source": [ "Q3" ] }, { "cell_type": "code", "execution_count": null, "id": "59d2cfbc-c5c5-4766-9a96-3fe66d2b4288", "metadata": { "tags": [] }, "outputs": [], "source": [ "query = 'What steps can the customer take to make an appointment at the nearest Apple Store or authorized service provider for iPhone repair?'" ] }, { "cell_type": "code", "execution_count": null, "id": "dcee956c-2492-4671-96f9-05d65b253444", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt = f'{context}\\n{query}'" ] }, { "cell_type": "code", "execution_count": null, "id": "13b0a313-9e45-4478-b2b7-07ba70b7d7bd", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = {'text_inputs': prompt, \n", " 'max_length': MAX_LENGTH, \n", " 'num_return_sequences': NUM_RETURN_SEQUENCES,\n", " 'top_k': TOP_K,\n", " 'top_p': TOP_P,\n", " 'do_sample': DO_SAMPLE}" ] }, { "cell_type": "code", "execution_count": null, "id": "b57fab52-b93f-4436-ab6c-1d1c966b8dc1", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = json.dumps(payload).encode('utf-8')" ] }, { "cell_type": "code", "execution_count": null, "id": "d7dbbd31-ce58-4d57-9d30-29811de2dc20", "metadata": { "tags": [] }, "outputs": [], "source": [ "response = client.invoke_endpoint(EndpointName=endpoint_name, \n", " ContentType=CONTENT_TYPE, \n", " Body=payload)" ] }, { "cell_type": "code", "execution_count": null, "id": "1f0cf919-3501-43e4-93a8-918a16054624", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_predictions = json.loads(response['Body'].read())\n", "generated_text = model_predictions['generated_texts'][0]\n", "logger.info(f'Response: {generated_text}')" ] }, { "cell_type": "markdown", "id": "f9b85ca1-92f5-4d5a-b5d5-82f8655d49c0", "metadata": {}, "source": [ "#### C. Sentiment Analysis" ] }, { "cell_type": "code", "execution_count": null, "id": "be1fd8d0-f903-4d9d-bfee-b3d070615065", "metadata": { "tags": [] }, "outputs": [], "source": [ "query = 'What is the overall sentiment and sentiment score of the conversation between the customer and the agent'" ] }, { "cell_type": "code", "execution_count": null, "id": "b4b68dde-d07a-4821-ac1f-04f0d904ddbf", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt = f'{context}\\n{query}'" ] }, { "cell_type": "code", "execution_count": null, "id": "3387a9ba-0f93-4d44-abd9-5e9fc55d51ea", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = {'text_inputs': prompt, \n", " 'max_length': MAX_LENGTH, \n", " 'num_return_sequences': NUM_RETURN_SEQUENCES,\n", " 'top_k': TOP_K,\n", " 'top_p': TOP_P,\n", " 'do_sample': DO_SAMPLE}" ] }, { "cell_type": "code", "execution_count": null, "id": "2d919698-73b6-404e-8ed1-e9bb38b6d404", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = json.dumps(payload).encode('utf-8')" ] }, { "cell_type": "code", "execution_count": null, "id": "2649b6e3-f77e-4f1c-bb67-9849cbc212bf", "metadata": { "tags": [] }, "outputs": [], "source": [ "response = client.invoke_endpoint(EndpointName=endpoint_name, \n", " ContentType=CONTENT_TYPE, \n", " Body=payload)" ] }, { "cell_type": "code", "execution_count": null, "id": "adc6ab61-5714-44f8-a2b6-e2e6350e85a1", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_predictions = json.loads(response['Body'].read())\n", "generated_text = model_predictions['generated_texts'][0]\n", "logger.info(f'Response: {generated_text}')" ] }, { "cell_type": "code", "execution_count": null, "id": "db7f17a4-8363-46f9-a011-a72033b95615", "metadata": { "tags": [] }, "outputs": [], "source": [ "sentiment = generated_text" ] }, { "cell_type": "markdown", "id": "8425737b-6c30-4f98-ac08-1f3e9a0aca33", "metadata": {}, "source": [ "#### D. Sentiment Phrase Extraction" ] }, { "cell_type": "code", "execution_count": null, "id": "3b5feab9-69a9-4ee0-a3a0-97e7ce07adf7", "metadata": { "tags": [] }, "outputs": [], "source": [ "query = f'identify any specific words, phrases, or context that influenced the {sentiment} sentiment'" ] }, { "cell_type": "code", "execution_count": null, "id": "f87eb75d-5fb7-483b-a837-0682656163a5", "metadata": { "tags": [] }, "outputs": [], "source": [ "prompt = f'{context}\\n{query}'" ] }, { "cell_type": "code", "execution_count": null, "id": "cceab55b-9929-4176-8ad1-0c1bb2ab61a4", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = {'text_inputs': prompt, \n", " 'max_length': MAX_LENGTH, \n", " 'num_return_sequences': NUM_RETURN_SEQUENCES,\n", " 'top_k': TOP_K,\n", " 'top_p': TOP_P,\n", " 'do_sample': DO_SAMPLE}" ] }, { "cell_type": "code", "execution_count": null, "id": "818b1ae3-0013-41b6-a2b4-9cdc659b7dcc", "metadata": { "tags": [] }, "outputs": [], "source": [ "payload = json.dumps(payload).encode('utf-8')" ] }, { "cell_type": "code", "execution_count": null, "id": "c2964d60-9d83-4d4e-ba20-f5a2730cf9da", "metadata": { "tags": [] }, "outputs": [], "source": [ "response = client.invoke_endpoint(EndpointName=endpoint_name, \n", " ContentType=CONTENT_TYPE, \n", " Body=payload)" ] }, { "cell_type": "code", "execution_count": null, "id": "10c76e8d-2bc7-4a78-90b7-7fd7a3edafd7", "metadata": { "tags": [] }, "outputs": [], "source": [ "model_predictions = json.loads(response['Body'].read())\n", "generated_text = model_predictions['generated_texts'][0]\n", "logger.info(f'Response: {generated_text}')" ] }, { "cell_type": "code", "execution_count": null, "id": "57321091-2855-4f3b-96ef-05bc783f50b9", "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.t3.medium", "kernelspec": { "display_name": "Python 3 (Data Science)", "language": "python", "name": "python3__SAGEMAKER_INTERNAL__arn:aws:sagemaker:us-east-1:081325390199:image/datascience-1.0" }, "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.7.10" } }, "nbformat": 4, "nbformat_minor": 5 }