|
28 | 28 | from sagemaker.tuner import (_TuningJob, create_identical_dataset_and_algorithm_tuner,
|
29 | 29 | create_transfer_learning_tuner, HyperparameterTuner, WarmStartConfig,
|
30 | 30 | WarmStartTypes)
|
| 31 | +from sagemaker.session import s3_input |
31 | 32 |
|
32 | 33 | DATA_DIR = os.path.join(os.path.dirname(__file__), '..', 'data')
|
33 | 34 | MODEL_DATA = "s3://bucket/model.tar.gz"
|
@@ -286,6 +287,31 @@ def test_fit_mxnet_with_vpc_config(sagemaker_session, tuner):
|
286 | 287 | assert tune_kwargs['vpc_config'] == {'Subnets': subnets, 'SecurityGroupIds': security_group_ids}
|
287 | 288 |
|
288 | 289 |
|
| 290 | +def test_s3_input_mode(sagemaker_session, tuner): |
| 291 | + expected_input_mode = 'Pipe' |
| 292 | + |
| 293 | + script_path = os.path.join(DATA_DIR, 'mxnet_mnist', 'failure_script.py') |
| 294 | + mxnet = MXNet(entry_point=script_path, |
| 295 | + role=ROLE, |
| 296 | + framework_version=FRAMEWORK_VERSION, |
| 297 | + train_instance_count=TRAIN_INSTANCE_COUNT, |
| 298 | + train_instance_type=TRAIN_INSTANCE_TYPE, |
| 299 | + sagemaker_session=sagemaker_session) |
| 300 | + tuner.estimator = mxnet |
| 301 | + |
| 302 | + tags = [{'Name': 'some-tag-without-a-value'}] |
| 303 | + tuner.tags = tags |
| 304 | + |
| 305 | + hyperparameter_ranges = {'num_components': IntegerParameter(2, 4), |
| 306 | + 'algorithm_mode': CategoricalParameter(['regular', 'randomized'])} |
| 307 | + tuner._hyperparameter_ranges = hyperparameter_ranges |
| 308 | + |
| 309 | + tuner.fit(inputs=s3_input('s3://mybucket/train_manifest', input_mode=expected_input_mode)) |
| 310 | + |
| 311 | + actual_input_mode = sagemaker_session.method_calls[1][2]['input_mode'] |
| 312 | + assert actual_input_mode == expected_input_mode |
| 313 | + |
| 314 | + |
289 | 315 | def test_fit_pca_with_inter_container_traffic_encryption_flag(sagemaker_session, tuner):
|
290 | 316 | pca = PCA(ROLE, TRAIN_INSTANCE_COUNT, TRAIN_INSTANCE_TYPE, NUM_COMPONENTS,
|
291 | 317 | base_job_name='pca', sagemaker_session=sagemaker_session,
|
|
0 commit comments