Created
June 11, 2022 05:58
-
-
Save nsakki55/bfabcc8d05f9cc82ebfa04571749dc86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "5d87bdcf", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from sagemaker.estimator import Estimator\n", | |
"\n", | |
"job_name = \"extend-sagemaker-container-ctr-prediction-\" + strftime(\"%Y%m%d-%H-%M-%S\", gmtime())\n", | |
"\n", | |
"hyperparameters = {\"max_alpha\": 0.2}\n", | |
"\n", | |
"enable_local_mode_training=False\n", | |
"if enable_local_mode_training:\n", | |
" train_instance_type = \"local\"\n", | |
" inputs = {\"train\": f\"file://{train_file}\", \"validation\": f\"file://{valiation_file}\", \"test\": f\"file://{test_file}\"}\n", | |
"else:\n", | |
" train_instance_type = \"ml.m5.large\"\n", | |
" inputs = {\"train\": s3_train_data, \"validation\": s3_validation_data, \"test\": s3_test_data}\n", | |
"\n", | |
"\n", | |
"estimator = Estimator(image_uri=f'{account}.dkr.ecr.ap-northeast-1.amazonaws.com/ctr-prediction-extend-sagemaker-container:latest',\n", | |
" role=role,\n", | |
" instance_count=1,\n", | |
" instance_type=train_instance_type,\n", | |
" hyperparameters=hyperparameters,\n", | |
" base_job_name=job_name)\n", | |
"\n", | |
"estimator.fit(inputs)" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"language": "python", | |
"name": "python3" | |
}, | |
"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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment