File tree 2 files changed +7
-13
lines changed
resources/mnist/default_model_eia/code
2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -102,18 +102,12 @@ def _test_default_inference(
102
102
sagemaker_session = sagemaker_session ,
103
103
)
104
104
with timeout_and_delete_endpoint (endpoint_name , sagemaker_session , minutes = 30 ):
105
- # Use accelerator type to differentiate EI vs. CPU and GPU. Don't use processor value
106
- if accelerator_type is not None :
107
- predictor = pytorch .deploy (
108
- initial_instance_count = 1 ,
109
- instance_type = instance_type ,
110
- accelerator_type = accelerator_type ,
111
- endpoint_name = endpoint_name ,
112
- )
113
- else :
114
- predictor = pytorch .deploy (
115
- initial_instance_count = 1 , instance_type = instance_type , endpoint_name = endpoint_name
116
- )
105
+ predictor = pytorch .deploy (
106
+ initial_instance_count = 1 ,
107
+ instance_type = instance_type ,
108
+ accelerator_type = accelerator_type ,
109
+ endpoint_name = endpoint_name ,
110
+ )
117
111
118
112
if accelerator_type :
119
113
batch_size = 100
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def predict_fn(input_data, model):
26
26
logger .info ('Performing EIA inference with Torch JIT context with input of size {}' .format (input_data .shape ))
27
27
# With EI, client instance should be CPU for cost-efficiency.
28
28
# Sub-graphs with unsupported arguments run locally. Server runs with CUDA
29
- device = torch .device ('cuda' if torch . cuda . is_available () else ' cpu' )
29
+ device = torch .device ('cpu' )
30
30
model = model .to (device )
31
31
input_data = input_data .to (device )
32
32
with torch .no_grad ():
You can’t perform that action at this time.
0 commit comments