{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Create Amazon SageMaker Autopilot job for audio embedding classification\n", "- Use Python 3 Data Scientist kernel in SageMaker Studio\n", "- Train and deploy this model after AudioEmbeddingModel\n", "- Create a CSV file with audio embedding output from AudioEembeddingModel\n", "- Upload CSV file into S3 and run following code to generate an Autopilot job" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import boto3\n", "client = boto3.client('sagemaker')\n", "response = client.create_auto_ml_job(\n", " AutoMLJobName='Audio_Embedding_Classification_Autopilot',\n", " InputDataConfig=[\n", " {\n", " 'DataSource': {\n", " 'S3DataSource': {\n", " 'S3DataType': 'S3Prefix',\n", " 'S3Uri': 's3://S3_BUCKET_NAME/PATH/TO/DATA.csv'\n", " }\n", " },\n", " 'CompressionType': 'None',\n", " 'TargetAttributeName': 'AUDIO_CLASS'\n", " },\n", " ],\n", " OutputDataConfig={\n", " 'S3OutputPath': 's3://S3_BUCKET_NAME/AutoML_output/'\n", " },\n", " ProblemType='MulticlassClassification',\n", " AutoMLJobObjective={\n", " 'MetricName':'F1'\n", " },\n", " AutoMLJobConfig={\n", " 'CompletionCriteria': {\n", " 'MaxCandidates': 250,\n", " 'MaxRuntimePerTrainingJobInSeconds': 86400,\n", " 'MaxAutoMLJobRuntimeInSeconds': 2592000\n", " },\n", " },\n", " RoleArn='arn:aws:iam::ACCOUNT_NUMBER:role/service-role/AmazonSageMaker-ExecutionRole',\n", " ModelDeployConfig={\n", " 'AutoGenerateEndpointName': False,\n", " 'EndpointName': 'Audio_Embedding_Classification_Endpoint'\n", " }\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "response = client.describe_auto_ml_job(\n", " AutoMLJobName='Audio_Embedding_Classification_Autopilot'\n", ")\n", "response" ] } ], "metadata": { "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": 4 }