@@ -241,7 +241,6 @@ def train(self, image, input_mode, input_config, role, job_name, output_config,
241
241
'TrainingImage' : image ,
242
242
'TrainingInputMode' : input_mode
243
243
},
244
- # 'HyperParameters': hyperparameters,
245
244
'InputDataConfig' : input_config ,
246
245
'OutputDataConfig' : output_config ,
247
246
'TrainingJobName' : job_name ,
@@ -259,7 +258,7 @@ def train(self, image, input_mode, input_config, role, job_name, output_config,
259
258
def tune (self , job_name , strategy , objective_type , objective_metric_name ,
260
259
max_jobs , max_parallel_jobs , parameter_ranges ,
261
260
static_hyperparameters , image , input_mode , metric_definitions ,
262
- role , input_config , output_config , resource_config , stop_condition ):
261
+ role , input_config , output_config , resource_config , stop_condition , tags ):
263
262
"""Create an Amazon SageMaker hyperparameter tuning job
264
263
265
264
Args:
@@ -292,6 +291,7 @@ def tune(self, job_name, strategy, objective_type, objective_metric_name,
292
291
instance_type (str): Type of EC2 instance to use for training, for example, 'ml.c4.xlarge'.
293
292
stop_condition (dict): Defines when training shall finish. Contains entries that can be understood by the
294
293
service like ``MaxRuntimeInSeconds``.
294
+ tags (list[dict]): List of tags for labeling the tuning job.
295
295
"""
296
296
tune_request = {
297
297
'HyperParameterTuningJobName' : job_name ,
@@ -324,6 +324,9 @@ def tune(self, job_name, strategy, objective_type, objective_metric_name,
324
324
if metric_definitions is not None :
325
325
tune_request ['TrainingJobDefinition' ]['AlgorithmSpecification' ]['MetricDefinitions' ] = metric_definitions
326
326
327
+ if tags is not None :
328
+ tune_request ['Tags' ] = tags
329
+
327
330
LOGGER .info ('Creating hyperparameter tuning job with name: {}' .format (job_name ))
328
331
LOGGER .debug ('tune request: {}' .format (json .dumps (tune_request , indent = 4 )))
329
332
self .sagemaker_client .create_hyper_parameter_tuning_job (** tune_request )
0 commit comments