17
17
18
18
import pytest
19
19
20
- from sagemaker .debugger import Rule
21
- from sagemaker .debugger import DebuggerHookConfig
22
- from sagemaker .debugger import TensorBoardOutputConfig
23
-
24
- from sagemaker .debugger import rule_configs
20
+ from sagemaker .debugger import DebuggerHookConfig , Rule , rule_configs , TensorBoardOutputConfig
25
21
from sagemaker .mxnet .estimator import MXNet
26
- from tests .integ import DATA_DIR , PYTHON_VERSION , TRAINING_DEFAULT_TIMEOUT_MINUTES
22
+ from tests .integ import DATA_DIR , TRAINING_DEFAULT_TIMEOUT_MINUTES
27
23
from tests .integ .retry import retries
28
24
from tests .integ .timeout import timeout
29
25
60
56
# TODO-reinvent-2019: test get_debugger_artifacts_path and get_tensorboard_artifacts_path
61
57
62
58
63
- def test_mxnet_with_rules (sagemaker_session , mxnet_full_version , cpu_instance_type ):
59
+ def test_mxnet_with_rules (
60
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
61
+ ):
64
62
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
65
63
rules = [
66
64
Rule .sagemaker (rule_configs .vanishing_gradient ()),
@@ -77,7 +75,7 @@ def test_mxnet_with_rules(sagemaker_session, mxnet_full_version, cpu_instance_ty
77
75
entry_point = script_path ,
78
76
role = "SageMakerRole" ,
79
77
framework_version = mxnet_full_version ,
80
- py_version = PYTHON_VERSION ,
78
+ py_version = mxnet_full_py_version ,
81
79
train_instance_count = 1 ,
82
80
train_instance_type = cpu_instance_type ,
83
81
sagemaker_session = sagemaker_session ,
@@ -119,7 +117,9 @@ def test_mxnet_with_rules(sagemaker_session, mxnet_full_version, cpu_instance_ty
119
117
_wait_and_assert_that_no_rule_jobs_errored (training_job = mx .latest_training_job )
120
118
121
119
122
- def test_mxnet_with_custom_rule (sagemaker_session , mxnet_full_version , cpu_instance_type ):
120
+ def test_mxnet_with_custom_rule (
121
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
122
+ ):
123
123
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
124
124
rules = [_get_custom_rule (sagemaker_session )]
125
125
@@ -130,7 +130,7 @@ def test_mxnet_with_custom_rule(sagemaker_session, mxnet_full_version, cpu_insta
130
130
entry_point = script_path ,
131
131
role = "SageMakerRole" ,
132
132
framework_version = mxnet_full_version ,
133
- py_version = PYTHON_VERSION ,
133
+ py_version = mxnet_full_py_version ,
134
134
train_instance_count = 1 ,
135
135
train_instance_type = cpu_instance_type ,
136
136
sagemaker_session = sagemaker_session ,
@@ -166,7 +166,9 @@ def test_mxnet_with_custom_rule(sagemaker_session, mxnet_full_version, cpu_insta
166
166
_wait_and_assert_that_no_rule_jobs_errored (training_job = mx .latest_training_job )
167
167
168
168
169
- def test_mxnet_with_debugger_hook_config (sagemaker_session , mxnet_full_version , cpu_instance_type ):
169
+ def test_mxnet_with_debugger_hook_config (
170
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
171
+ ):
170
172
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
171
173
debugger_hook_config = DebuggerHookConfig (
172
174
s3_output_path = os .path .join (
@@ -181,7 +183,7 @@ def test_mxnet_with_debugger_hook_config(sagemaker_session, mxnet_full_version,
181
183
entry_point = script_path ,
182
184
role = "SageMakerRole" ,
183
185
framework_version = mxnet_full_version ,
184
- py_version = PYTHON_VERSION ,
186
+ py_version = mxnet_full_py_version ,
185
187
train_instance_count = 1 ,
186
188
train_instance_type = cpu_instance_type ,
187
189
sagemaker_session = sagemaker_session ,
@@ -204,7 +206,7 @@ def test_mxnet_with_debugger_hook_config(sagemaker_session, mxnet_full_version,
204
206
205
207
206
208
def test_mxnet_with_rules_and_debugger_hook_config (
207
- sagemaker_session , mxnet_full_version , cpu_instance_type
209
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
208
210
):
209
211
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
210
212
rules = [
@@ -227,7 +229,7 @@ def test_mxnet_with_rules_and_debugger_hook_config(
227
229
entry_point = script_path ,
228
230
role = "SageMakerRole" ,
229
231
framework_version = mxnet_full_version ,
230
- py_version = PYTHON_VERSION ,
232
+ py_version = mxnet_full_py_version ,
231
233
train_instance_count = 1 ,
232
234
train_instance_type = cpu_instance_type ,
233
235
sagemaker_session = sagemaker_session ,
@@ -272,7 +274,7 @@ def test_mxnet_with_rules_and_debugger_hook_config(
272
274
273
275
274
276
def test_mxnet_with_custom_rule_and_debugger_hook_config (
275
- sagemaker_session , mxnet_full_version , cpu_instance_type
277
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
276
278
):
277
279
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
278
280
rules = [_get_custom_rule (sagemaker_session )]
@@ -289,7 +291,7 @@ def test_mxnet_with_custom_rule_and_debugger_hook_config(
289
291
entry_point = script_path ,
290
292
role = "SageMakerRole" ,
291
293
framework_version = mxnet_full_version ,
292
- py_version = PYTHON_VERSION ,
294
+ py_version = mxnet_full_py_version ,
293
295
train_instance_count = 1 ,
294
296
train_instance_type = cpu_instance_type ,
295
297
sagemaker_session = sagemaker_session ,
@@ -328,7 +330,7 @@ def test_mxnet_with_custom_rule_and_debugger_hook_config(
328
330
329
331
330
332
def test_mxnet_with_tensorboard_output_config (
331
- sagemaker_session , mxnet_full_version , cpu_instance_type
333
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
332
334
):
333
335
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
334
336
tensorboard_output_config = TensorBoardOutputConfig (
@@ -344,7 +346,7 @@ def test_mxnet_with_tensorboard_output_config(
344
346
entry_point = script_path ,
345
347
role = "SageMakerRole" ,
346
348
framework_version = mxnet_full_version ,
347
- py_version = PYTHON_VERSION ,
349
+ py_version = mxnet_full_py_version ,
348
350
train_instance_count = 1 ,
349
351
train_instance_type = cpu_instance_type ,
350
352
sagemaker_session = sagemaker_session ,
@@ -370,7 +372,9 @@ def test_mxnet_with_tensorboard_output_config(
370
372
371
373
372
374
@pytest .mark .canary_quick
373
- def test_mxnet_with_all_rules_and_configs (sagemaker_session , mxnet_full_version , cpu_instance_type ):
375
+ def test_mxnet_with_all_rules_and_configs (
376
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
377
+ ):
374
378
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
375
379
rules = [
376
380
Rule .sagemaker (rule_configs .vanishing_gradient ()),
@@ -398,7 +402,7 @@ def test_mxnet_with_all_rules_and_configs(sagemaker_session, mxnet_full_version,
398
402
entry_point = script_path ,
399
403
role = "SageMakerRole" ,
400
404
framework_version = mxnet_full_version ,
401
- py_version = PYTHON_VERSION ,
405
+ py_version = mxnet_full_py_version ,
402
406
train_instance_count = 1 ,
403
407
train_instance_type = cpu_instance_type ,
404
408
sagemaker_session = sagemaker_session ,
@@ -441,7 +445,7 @@ def test_mxnet_with_all_rules_and_configs(sagemaker_session, mxnet_full_version,
441
445
442
446
443
447
def test_mxnet_with_debugger_hook_config_disabled (
444
- sagemaker_session , mxnet_full_version , cpu_instance_type
448
+ sagemaker_session , mxnet_full_version , mxnet_full_py_version , cpu_instance_type
445
449
):
446
450
with timeout (minutes = TRAINING_DEFAULT_TIMEOUT_MINUTES ):
447
451
script_path = os .path .join (DATA_DIR , "mxnet_mnist" , "mnist_gluon.py" )
@@ -451,7 +455,7 @@ def test_mxnet_with_debugger_hook_config_disabled(
451
455
entry_point = script_path ,
452
456
role = "SageMakerRole" ,
453
457
framework_version = mxnet_full_version ,
454
- py_version = PYTHON_VERSION ,
458
+ py_version = mxnet_full_py_version ,
455
459
train_instance_count = 1 ,
456
460
train_instance_type = cpu_instance_type ,
457
461
sagemaker_session = sagemaker_session ,
0 commit comments