27
27
28
28
from sagemaker .local import LocalSession , LocalSagemakerRuntimeClient , LocalSagemakerClient
29
29
from sagemaker .mxnet import MXNet
30
- from sagemaker .tensorflow import TensorFlow
30
+ from sagemaker .tensorflow import estimator
31
31
32
32
# endpoint tests all use the same port, so we use this lock to prevent concurrent execution
33
33
LOCK_PATH = os .path .join (tempfile .gettempdir (), "sagemaker_test_local_mode_lock" )
@@ -90,7 +90,7 @@ def test_tf_local_mode(sagemaker_local_session):
90
90
with stopit .ThreadingTimeout (5 * 60 , swallow_exc = False ):
91
91
script_path = os .path .join (DATA_DIR , "iris" , "iris-dnn-classifier.py" )
92
92
93
- estimator = TensorFlow (
93
+ tensorflow_estimator = estimator . TensorFlow (
94
94
entry_point = script_path ,
95
95
role = "SageMakerRole" ,
96
96
framework_version = "1.12" ,
@@ -103,16 +103,16 @@ def test_tf_local_mode(sagemaker_local_session):
103
103
sagemaker_session = sagemaker_local_session ,
104
104
)
105
105
106
- inputs = estimator .sagemaker_session .upload_data (
106
+ inputs = tensorflow_estimator .sagemaker_session .upload_data (
107
107
path = DATA_PATH , key_prefix = "integ-test-data/tf_iris"
108
108
)
109
- estimator .fit (inputs )
110
- print ("job succeeded: {}" .format (estimator .latest_training_job .name ))
109
+ tensorflow_estimator .fit (inputs )
110
+ print ("job succeeded: {}" .format (tensorflow_estimator .latest_training_job .name ))
111
111
112
- endpoint_name = estimator .latest_training_job .name
112
+ endpoint_name = tensorflow_estimator .latest_training_job .name
113
113
with lock .lock (LOCK_PATH ):
114
114
try :
115
- json_predictor = estimator .deploy (
115
+ json_predictor = tensorflow_estimator .deploy (
116
116
initial_instance_count = 1 , instance_type = "local" , endpoint_name = endpoint_name
117
117
)
118
118
@@ -124,7 +124,7 @@ def test_tf_local_mode(sagemaker_local_session):
124
124
125
125
assert dict_result == list_result
126
126
finally :
127
- estimator .delete_endpoint ()
127
+ tensorflow_estimator .delete_endpoint ()
128
128
129
129
130
130
@pytest .mark .local_mode
@@ -133,7 +133,7 @@ def test_tf_distributed_local_mode(sagemaker_local_session):
133
133
with stopit .ThreadingTimeout (5 * 60 , swallow_exc = False ):
134
134
script_path = os .path .join (DATA_DIR , "iris" , "iris-dnn-classifier.py" )
135
135
136
- estimator = TensorFlow (
136
+ tensorflow_estimator = estimator . TensorFlow (
137
137
entry_point = script_path ,
138
138
role = "SageMakerRole" ,
139
139
framework_version = "1.12" ,
@@ -147,14 +147,14 @@ def test_tf_distributed_local_mode(sagemaker_local_session):
147
147
)
148
148
149
149
inputs = "file://" + DATA_PATH
150
- estimator .fit (inputs )
151
- print ("job succeeded: {}" .format (estimator .latest_training_job .name ))
150
+ tensorflow_estimator .fit (inputs )
151
+ print ("job succeeded: {}" .format (tensorflow_estimator .latest_training_job .name ))
152
152
153
- endpoint_name = estimator .latest_training_job .name
153
+ endpoint_name = tensorflow_estimator .latest_training_job .name
154
154
155
155
with lock .lock (LOCK_PATH ):
156
156
try :
157
- json_predictor = estimator .deploy (
157
+ json_predictor = tensorflow_estimator .deploy (
158
158
initial_instance_count = 1 , instance_type = "local" , endpoint_name = endpoint_name
159
159
)
160
160
@@ -166,7 +166,7 @@ def test_tf_distributed_local_mode(sagemaker_local_session):
166
166
167
167
assert dict_result == list_result
168
168
finally :
169
- estimator .delete_endpoint ()
169
+ tensorflow_estimator .delete_endpoint ()
170
170
171
171
172
172
@pytest .mark .local_mode
@@ -175,7 +175,7 @@ def test_tf_local_data(sagemaker_local_session):
175
175
with stopit .ThreadingTimeout (5 * 60 , swallow_exc = False ):
176
176
script_path = os .path .join (DATA_DIR , "iris" , "iris-dnn-classifier.py" )
177
177
178
- estimator = TensorFlow (
178
+ tensorflow_estimator = estimator . TensorFlow (
179
179
entry_point = script_path ,
180
180
role = "SageMakerRole" ,
181
181
framework_version = "1.12" ,
@@ -189,13 +189,13 @@ def test_tf_local_data(sagemaker_local_session):
189
189
)
190
190
191
191
inputs = "file://" + DATA_PATH
192
- estimator .fit (inputs )
193
- print ("job succeeded: {}" .format (estimator .latest_training_job .name ))
192
+ tensorflow_estimator .fit (inputs )
193
+ print ("job succeeded: {}" .format (tensorflow_estimator .latest_training_job .name ))
194
194
195
- endpoint_name = estimator .latest_training_job .name
195
+ endpoint_name = tensorflow_estimator .latest_training_job .name
196
196
with lock .lock (LOCK_PATH ):
197
197
try :
198
- json_predictor = estimator .deploy (
198
+ json_predictor = tensorflow_estimator .deploy (
199
199
initial_instance_count = 1 , instance_type = "local" , endpoint_name = endpoint_name
200
200
)
201
201
@@ -207,7 +207,7 @@ def test_tf_local_data(sagemaker_local_session):
207
207
208
208
assert dict_result == list_result
209
209
finally :
210
- estimator .delete_endpoint ()
210
+ tensorflow_estimator .delete_endpoint ()
211
211
212
212
213
213
@pytest .mark .local_mode
@@ -216,7 +216,7 @@ def test_tf_local_data_local_script():
216
216
with stopit .ThreadingTimeout (5 * 60 , swallow_exc = False ):
217
217
script_path = os .path .join (DATA_DIR , "iris" , "iris-dnn-classifier.py" )
218
218
219
- estimator = TensorFlow (
219
+ tensorflow_estimator = estimator . TensorFlow (
220
220
entry_point = script_path ,
221
221
role = "SageMakerRole" ,
222
222
framework_version = "1.12" ,
@@ -231,13 +231,13 @@ def test_tf_local_data_local_script():
231
231
232
232
inputs = "file://" + DATA_PATH
233
233
234
- estimator .fit (inputs )
235
- print ("job succeeded: {}" .format (estimator .latest_training_job .name ))
234
+ tensorflow_estimator .fit (inputs )
235
+ print ("job succeeded: {}" .format (tensorflow_estimator .latest_training_job .name ))
236
236
237
- endpoint_name = estimator .latest_training_job .name
237
+ endpoint_name = tensorflow_estimator .latest_training_job .name
238
238
with lock .lock (LOCK_PATH ):
239
239
try :
240
- json_predictor = estimator .deploy (
240
+ json_predictor = tensorflow_estimator .deploy (
241
241
initial_instance_count = 1 , instance_type = "local" , endpoint_name = endpoint_name
242
242
)
243
243
@@ -249,7 +249,7 @@ def test_tf_local_data_local_script():
249
249
250
250
assert dict_result == list_result
251
251
finally :
252
- estimator .delete_endpoint ()
252
+ tensorflow_estimator .delete_endpoint ()
253
253
254
254
255
255
@pytest .mark .local_mode
0 commit comments