Lambda and Batch Transform

Hi!

I am trying to setup a lambda and a batch transform. These are the steps that was executed in Lambda:

  1. HuggingFaceModel()
  2. HuggingFaceModel.transformer()
  3. HuggingFaceModel.transfomer.transform()

The issue is that step #3 waits for a response return from sagemaker’s batch transform job. This takes several minutes which is billed for lambda. For other batch transform jobs using boto3.sagemaker.create_transform_job, the status is returned immediately after a successful send. Does anyone have any experience with the batch transform on lambda and having it returned immediately without waiting for a response? Thanks!

Ha! As I was writing this out, I realized then I can just call boto3.sagemaker.create_transform_job and it works!

Hello @vng510,

you can still use the sagemaker classes in your lambda functions.

HuggingFaceModel.transformer.transform() accepts a parameter called wait which defines wether the call should wait until the job completes.
So when you add HuggingFaceModel.transformer.transform(wait=False) it will create the Batch Job but doesn’t wait for anything.

https://sagemaker.readthedocs.io/en/stable/api/inference/transformer.html#sagemaker.transformer.Transformer.transform

Thanks philschmid. I missed that completely.

1 Like