Skip to content

Commit 2fb97f9

Browse files
authored
Merge pull request #27 from dzorlu/main
log predict time properly
2 parents 96cf2ec + 6a562d8 commit 2fb97f9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sagemaker_huggingface_inference_toolkit/handler_service.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,14 @@ def transform_fn(self, model, input_data, content_type, accept):
188188
processed_data = self.preprocess(input_data, content_type)
189189
preprocess_time = time.time() - start_time
190190
predictions = self.predict(processed_data, model)
191-
predict_time = time.time() - preprocess_time
191+
predict_time = time.time() - preprocess_time - start_time
192192
response = self.postprocess(predictions, accept)
193+
postprocess_time = time.time() - predict_time - preprocess_time - start_time
193194

194195
logger.info(
195196
f"Preprocess time - {preprocess_time * 1000} ms\n"
196197
f"Predict time - {predict_time * 1000} ms\n"
197-
f"Postprocess time - {(time.time() - predict_time) * 1000} ms"
198+
f"Postprocess time - {postprocess_time * 1000} ms"
198199
)
199200

200201
return response

0 commit comments

Comments
 (0)