-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsagemaker_main.template
executable file
·48 lines (40 loc) · 1.4 KB
/
sagemaker_main.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import os
from sagemaker.tensorflow import TensorFlow
# (Option1) Run the training in Sagemaker
# train_instance_type = 'ml.m5.large'
# data_location = 's3://<s3_bucket_name>/kth_tfrecord'
# (Option2) For local running config
# train_instance_type = 'local'
# data_location = 'file:///Users/dongfenggu/Desktop/tfrecord/'
model_artifacts_location = 's3://<s3_bucket_name>/kth_result/artifacts'
custom_code_upload_location = 's3://<s3_bucket_name>/kth_result/customcode/tensorflow_c3d'
role = 'arn:aws:iam::<aws_account_id>:role/sagemaker-full-access-role'
HYPERPARAMETERS = {
'batch_size': 20,
'width': 120,
'height': 100,
'channel': 3,
'num_frames_per_clip': 16,
'train_total_video_clip': 300000,
'eval_total_video_clip': 100000,
'moving_average_decay': 0.9999,
'initial_learning_rate': 1e-4,
'decay_step': 5000,
'num_class': 6,
'lr_decay_factor': 0.1
}
source_dir = os.path.join(os.getcwd(), 'source_dir')
estimator = TensorFlow(
entry_point='c3d_estimator.py',
source_dir=source_dir,
role=role,
output_path=model_artifacts_location,
code_location=custom_code_upload_location,
train_instance_count=1,
train_volume_size=30, # GB
framework_version='1.8.0',
train_instance_type=train_instance_type,
training_steps=1,
evaluation_steps=1,
hyperparameters=HYPERPARAMETERS)
estimator.fit(data_location, run_tensorboard_locally=False)