Created
June 11, 2022 06:12
-
-
Save nsakki55/4082bd52bf45468acb96395d0f41c3d7 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": "e7ceb969", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from sagemaker.estimator import Estimator\n", | |
"\n", | |
"job_name = \"custom-toolkit-containe-ctr-prediction-\" + strftime(\"%Y%m%d-%H-%M-%S\", gmtime())\n", | |
"\n", | |
"hyperparameters = {\"rank\": 7, \"n_iter\": 12}\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}\", \"test\": f\"file://{test_file}\"}\n", | |
"else:\n", | |
" train_instance_type = \"ml.m5.large\"\n", | |
" inputs = {\"train\": s3_train_data, \"test\": s3_test_data}\n", | |
" \n", | |
"estimator = Estimator(image_uri=f'{account}.dkr.ecr.ap-northeast-1.amazonaws.com/ctr-prediction-custom-toolkit-container:latest',\n", | |
" role=role,\n", | |
" instance_count=1,\n", | |
" instance_type=train_instance_type,\n", | |
" output_path=output_location,\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