{ "cells": [ { "cell_type": "markdown", "id": "1e655174", "metadata": {}, "source": [ "# Lab: SKLearn Migration Challenge\n", "\n", "> *Run this notebook in the same environment you used for the 'Local Notebook': `Python 3 (Data Science 3.0)` on SageMaker Studio, or `conda_python3` on classic SageMaker Notebook Instances*" ] }, { "cell_type": "markdown", "id": "4529a76f-a5a1-4c1e-b394-e0a7fd5c1fc8", "metadata": {}, "source": [ "## Introduction\n", "Your new colleague in the data science team (who isn't very familiar with SageMaker) has written a nice notebook to tackle a classification problem with scikitlearn: [Local Notebook.ipynb](Local%20Notebook.ipynb)\n", "\n", "It works OK with the simple Iris data set they were working on before, but now they'd like to take advantage of some of the features of SageMaker to tackle bigger and harder challenges.\n", "\n", "Can you help refactor the Local Notebook code, to show them how to use SageMaker effectively?" ] }, { "cell_type": "markdown", "id": "e8e63195-8235-4dde-a337-99b8f3f13640", "metadata": {}, "source": [ "## Getting Started\n", "\n", "First, check you can run the [Local Notebook.ipynb](Local%20Notebook.ipynb) notebook through - reviewing what steps it takes.\n", "\n", "This notebook sets out a structure you can use to migrate code into, and lists out some of the changes you'll need to make at a high level. You can either work directly in here, or duplicate this notebook so you still have an unchanged copy of the original.\n", "\n", "Try to work through the sections first with an MVP goal in mind (fitting the model to data in S3 via a SageMaker Training Job, and deploying/using the model through a SageMaker Endpoint). The goal is to understand the big picture on how you can bring your own code to SageMaker and scale your training and deploy. You can always build more advanced models or more complex training code." ] }, { "cell_type": "markdown", "id": "1e2ad14a", "metadata": {}, "source": [ "## SKLearn \"script mode\" training and serving\n", "\n", "SageMaker provides [pre-built container images](https://docs.aws.amazon.com/sagemaker/latest/dg/docker-containers-prebuilt.html) for a range of ML frameworks, including Scikit-Learn, which allow you to bring custom models without worrying about building and maintaining your own container images or serving stacks: You can even install extra libraries by [providing a requirements.txt file](https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/using_sklearn.html#using-third-party-libraries) if you want.\n", "\n", "This pattern is sometimes called \"framework mode\" or [\"script mode\"](https://aws.amazon.com/blogs/machine-learning/bring-your-own-model-with-amazon-sagemaker-script-mode/) - separate from building fully-custom containers or using the pre-built algorithms.\n", "\n", "The [SageMaker Python SDK](https://github.com/aws/sagemaker-python-sdk) handles transferring your script to a SageMaker training instance. On the training instance, SageMaker's native SKlearn support sets up training-related environment variables and executes your training script. Script mode supports training with a Python script, a Python module, or a shell script." ] }, { "cell_type": "markdown", "id": "dec9d52a", "metadata": {}, "source": [ "## Dependencies\n", "Listing all our imports at the start helps to keep the requirements to run any script/file transparent up-front, and is specified by nearly every style guide including Python's official [PEP 8](https://peps.python.org/pep-0008/#imports)" ] }, { "cell_type": "code", "execution_count": null, "id": "cbee5f4e", "metadata": { "tags": [] }, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "\n", "# Python Built-Ins:\n", "import os\n", "\n", "# External Dependencies:\n", "import numpy as np\n", "import pandas as pd\n", "from sklearn.model_selection import train_test_split\n", "\n", "# TODO: What else will you need?\n", "# Have a look at the documentation: https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/sagemaker.sklearn.html\n", "# to see which libraries need to be imported to use sagemaker and the Sklearn estimator estimator\n" ] }, { "cell_type": "markdown", "id": "779e50c1", "metadata": {}, "source": [ "## Prepare the Data\n", "\n", "Initial data preparation will be similar to what we did in the [Local Notebook.ipynb](Local%20Notebook.ipynb)." ] }, { "cell_type": "code", "execution_count": null, "id": "b7e0f13e", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Fetch the sample dataset\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e31a6193", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Read in the data file and set headers\n" ] }, { "cell_type": "code", "execution_count": null, "id": "67246d93-d57d-4e4a-8d64-b284ef4f7692", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Check class distribution\n" ] }, { "cell_type": "markdown", "id": "db276004-f04a-426b-a546-93963d4cf930", "metadata": {}, "source": [ "If you want your model to be aware of class names, not just numeric IDs, you might want to represent these in a hyperparameter. Since hyperparameters [must be representable as strings](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html#sagemaker-CreateTrainingJob-request-HyperParameters), you'd need to represent the array somehow. In this example we'll just use a comma-separated string:" ] }, { "cell_type": "code", "execution_count": null, "id": "30372e74-bdea-4e6c-b4b6-3943af022170", "metadata": {}, "outputs": [], "source": [ "class_names_str = \",\".join(class_names)" ] }, { "cell_type": "code", "execution_count": null, "id": "53368b82", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Split the data into train and test CSVs (with headers)\n" ] }, { "cell_type": "markdown", "id": "95b0c48c", "metadata": { "tags": [] }, "source": [ "## Upload Data to Amazon S3\n", "\n", "To train in a SageMaker training job, rather than locally, we'll need the train and test datasets to be staged somewhere the job can access: Usually in Amazon S3.\n", "\n", "Modern versions of Pandas should support saving to S3 directly with `dataframe.to_csv(\"s3://{bucket_name}/{file_path}\")`\n", "\n", "> Alternatively, you can refer to the previous exercises for examples copying files between S3 and local storage using the aws s3 sync CLI command or using the boto3 SDK.\n", ">\n", "> The high-level [`aws s3 sync` command](https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html) synchronizes the contents of a local folder to or from an S3 bucket/folder. You can use options like `--delete` to remove objects from the target that are not present in the source, and `--include` or `--exclude` to filter what files get copied.\n", "\n", "But what should your `bucket_name` be? Use the **default SageMaker bucket** for your bucket name, as shown in previous labs." ] }, { "cell_type": "code", "execution_count": null, "id": "adb4586b-55d5-4ae0-a4df-74b6ba623339", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Look up the default SageMaker bucket for your bucket_name\n" ] }, { "cell_type": "code", "execution_count": null, "id": "38dc083e-f063-473b-a485-9a27ee514cb2", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Upload your `test` and `train` CSV data splits to your SageMaker default S3 bucket\n", "# You can use pandas to_csv(\"s3://...\") directly, the '!aws s3' CLI, or boto3 S3 as you prefer\n" ] }, { "cell_type": "markdown", "id": "3ebab5a1-4942-402e-9e51-6e6c2e903ea1", "metadata": {}, "source": [ "## Algorithm (\"Estimator\") Configuration and Run\n", "\n", "Instead of loading and fitting this data here in the notebook, we'll be creating a SKLearn Estimator through the SageMaker SDK, to run the code on a separate container that can be scaled as required.\n", "\n", "The [\"Using SKlearn with the SageMaker Python SDK\"](https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/using_sklearn.html#using-scikit-learn-with-the-sagemaker-python-sdk) docs give a good overview of this process. You should run your estimator in script mode (which is easier to follow than the old default legacy mode) and as Python 3.\n", "\n", "One thing you'll need to set up your training job is an [execution role](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-roles.html) the job should run with - to give it access to your S3 data. Let's look that role up first:" ] }, { "cell_type": "code", "execution_count": null, "id": "ec54617f-3db2-484c-88a2-0b304aa65932", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Look up the SageMaker Execution role to use for training, as in previous labs\n" ] }, { "cell_type": "markdown", "id": "06ae9c38-9e06-43c9-8e16-7d7896139d7d", "metadata": {}, "source": [ "Next, you're ready to:\n", "\n", "▶️ Use the **[src/main.py file](src/main.py) already prepared for you** in your local directory as your entry point to port code into. This includes a basic template, but with more TODOs you'll need to fill in.\n", "\n", "▶️ Define the 'estimator' here in the notebook, to configure how the training job should run your script.\n", "\n", "Remember these two sides connect together: The script receives parameters, local input data folders, and the target model output folder as CLI parameters and environment variables from the estimator." ] }, { "cell_type": "code", "execution_count": null, "id": "d39dcf9a", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Define your estimator using SKlearn framework\n" ] }, { "cell_type": "markdown", "id": "7b7e6446", "metadata": {}, "source": [ "> ⚠️ **Before running the actual training job** on SageMaker, we suggest running your script locally using the example command below.\n", ">\n", "> This can help you find and fix errors faster, because you won't need to wait for the job to start up each time.\n", "\n", "Do the number and names of the data **'channels'** in this command match your script?" ] }, { "cell_type": "code", "execution_count": null, "id": "c04e345e", "metadata": { "tags": [] }, "outputs": [], "source": [ "os.makedirs(\"data/model\", exist_ok=True)\n", "\n", "!python3 src/main.py \\\n", " --train ./data/train \\\n", " --test ./data/test \\\n", " --model_dir ./data/model \\\n", " --class_names {class_names_str} \\\n", " --n_estimators=100 \\\n", " --min_samples_leaf=3" ] }, { "cell_type": "markdown", "id": "8c126609", "metadata": {}, "source": [ "## Run the SageMaker Training Job\n", "\n", "When you're ready to try your script in a SageMaker training job, you can call `estimator.fit(...)` as we did in previous exercises: Specifying your input data location(s).\n", "\n", "Your job should have 2 input datasets: One for training, and one for test/validation. In SageMaker terminology, each input data set is a \"channel\" and we can name them however we like... Just make sure you're consistent about what you call each one!\n", "\n", "When training is complete, the training job will automatically upload the saved model to Amazon S3 ready for deployment." ] }, { "cell_type": "code", "execution_count": null, "id": "bbf3ee14", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Call the fit function, passing in the data you uploaded to S3 earlier\n" ] }, { "cell_type": "markdown", "id": "53f7105e", "metadata": {}, "source": [ "## Deploy and Use Your Model (Real-Time Inference)\n", "We are now ready to deploy our model to Sagemaker hosting services and make [real time predictions](https://docs.aws.amazon.com/sagemaker/latest/dg/realtime-endpoints.html).\n", "\n", "**Hint:** With the Scikit-Learn framework (where models may come in many different formats), you need to [define a `model_fn`](https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/using_sklearn.html#load-a-model) for loading your model at inference time. The script provided for training isn't automatically passed at inference time too, so the easiest way to link your script to the model endpoint is probably to create a `SKLearnModel` - rather than trying to `deploy()` your estimator directly." ] }, { "cell_type": "code", "execution_count": null, "id": "597d7902-cf4e-41f9-842e-221b91cc2469", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Create a SKLearnModel from your training job\n" ] }, { "cell_type": "code", "execution_count": null, "id": "97358fdd", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Deploy your trained model to a real time endpoint\n" ] }, { "cell_type": "markdown", "id": "b2dc771a", "metadata": {}, "source": [ "Let's now send some data to our model to predict.\n", "\n", "Note you'll need to send the correct input fields the model expects (X_test only, excluding label column), and will need to send it in a [format supported](https://sagemaker.readthedocs.io/en/stable/frameworks/sklearn/using_sklearn.html#get-predictions) by the deployed endpoint." ] }, { "cell_type": "code", "execution_count": null, "id": "102592c8", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Load some test data to test your model with, in the same format as it was trained on\n" ] }, { "cell_type": "code", "execution_count": null, "id": "12454966", "metadata": { "tags": [] }, "outputs": [], "source": [ "# TODO: Invoke your endpoint and return the predictions\n" ] }, { "cell_type": "markdown", "id": "e0ffac64-18cc-45c6-a4f0-c2dddd6ee7d7", "metadata": { "tags": [] }, "source": [ "## (Optional) Extension exercises\n", "\n", "By getting this far, hopefully you've been able to train your model on SageMaker, deploy it to an inference endpoint, and make some test predictions. Great going!\n", "\n", "If you have some extra time, try exploring these extension exercises for an extra challenge:\n", "\n", "- **Cut training costs easily with SageMaker Managed Spot Mode**: Spot Instances let you take advantage of unused capacity in the AWS cloud, at up to a 90% discount versus standard on-demand pricing! For small jobs like this, taking advantage of this discount is as easy as adding a couple of parameters to the [Estimator constructor](https://sagemaker.readthedocs.io/en/stable/estimators.html)\n", "\n", "> **Note** that in general, spot capacity is offered at a discounted rate because it's interruptible based on instantaneous demand... Longer-running training jobs should implement checkpoint saving and loading, so that they can efficiently resume if interrupted part way through. More information can be found on the [Managed Spot Training in Amazon SageMaker](https://docs.aws.amazon.com/sagemaker/latest/dg/model-managed-spot-training.html) page of the [SageMaker Developer Guide](https://docs.aws.amazon.com/sagemaker/latest/dg/)." ] }, { "cell_type": "markdown", "id": "7a6c6460-9b48-4421-95bd-d89889586e41", "metadata": {}, "source": [ "- **Batch Inference**: Many tabular data use-cases make predictions on batches of data, rather than real-time requests. [SageMaker Batch Transform](https://docs.aws.amazon.com/sagemaker/latest/dg/batch-transform.html) helps you run batches of data through your model and automatically spin up + shut down infrastructure when needed: There's no need to deploy an endpoint and orchestrate data batches yourself! See if you can run a batch transform job using your previously trained model.\n", "\n", "> **Hint:** There's a batch transform example in the [built-in XGBoost algorithm example notebook](../../builtin_algorithm_hpo_tabular/1%20Autopilot%20and%20XGBoost.ipynb) that might be useful to refer to, and check out the [SageMaker Python SDK user guide on Batch Transform](https://sagemaker.readthedocs.io/en/stable/overview.html#sagemaker-batch-transform) as well." ] }, { "cell_type": "markdown", "id": "abcf5fc1-3678-420a-9f9e-4561643994df", "metadata": {}, "source": [ "- **Automatic Model Tuning**: We already showed some model hyper-parameters in the local notebook. Can you connect these up as training job hyperparameters; set up metric scraping from your job logs; and use those hyperparameters + metrics to run a [SageMaker Automatic Model Tuning](https://sagemaker.readthedocs.io/en/stable/overview.html#sagemaker-automatic-model-tuning) run?\n", "\n", "> **Hint:** There's an HPO example in the [built-in XGBoost algorithm example notebook](../../builtin_algorithm_hpo_tabular/1%20Autopilot%20and%20XGBoost.ipynb), but for a custom algorithm you'll also need to supply `metric_definitions` to tell SageMaker how to read accuracy metrics from your training job logs." ] }, { "cell_type": "markdown", "id": "454223df-135b-4d5d-af7f-2c07c116eb89", "metadata": {}, "source": [ "## Clean-Up\n", "\n", "Remember to clean up any persistent resources that aren't needed anymore to save costs: The most significant of these are real-time prediction endpoints, and this SageMaker Notebook Instance.\n", "\n", "The SageMaker SDK [Predictor](https://sagemaker.readthedocs.io/en/stable/predictors.html) class provides an interface to clean up real-time prediction endpoints; and SageMaker Notebook Instances can be stopped through the SageMaker Console when you're finished.\n", "\n", "You might also like to clean up any S3 buckets / content we created, to prevent ongoing storage costs.\n" ] }, { "cell_type": "code", "execution_count": null, "id": "786389c3-2e58-4e07-ba2b-f2a8693440ac", "metadata": {}, "outputs": [], "source": [ "# TODO: Clean up any endpoints/etc to release resources\n" ] } ], "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 } ], "instance_type": "ml.t3.medium", "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 }