# Spot instances with Sagemaker batch transform?

**URL:** <https://discuss.huggingface.co/t/spot-instances-with-sagemaker-batch-transform/12681>\
**Category:** Amazon SageMaker\
**Created:** [December 9, 2021, 11:26pm UTC](https://discuss.huggingface.co/t/spot-instances-with-sagemaker-batch-transform/12681 "2021-12-09T23:26:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaximusDecimusMeridi](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/maximusdecimusmeridi/32/3390_2.png) [@MaximusDecimusMeridi](https://discuss.huggingface.co/u/MaximusDecimusMeridi)\
**Post date:** [December 9, 2021, 11:26pm UTC](https://discuss.huggingface.co/t/spot-instances-with-sagemaker-batch-transform/12681/1 "2021-12-09T23:26:03Z")

</div>

Is it possible to use spot instances for batch transform? Don’t see in either of these places

[https://sagemaker.readthedocs.io/en/stable/frameworks/huggingface/sagemaker.huggingface.html](https://sagemaker.readthedocs.io/en/stable/frameworks/huggingface/sagemaker.huggingface.html)  
ht tp s://sagemaker.readthedocs.io/en/stable/api/inference/transformer.html

Trying to pass “use\_spot\_instances=True” to either the HuggingFaceModel, HuggingFaceModel.transformer or HuggingFaceModel.transformer.transform() gives an error. I am using this notebook as an example.

> <https://github.com/huggingface/notebooks/blob/master/sagemaker/12_batch_transform_inference/sagemaker-notebook.ipynb>

THanks

---

<div class="post-metadata">

**Author:** ![OlivierCR](https://avatars.discourse-cdn.com/v4/letter/o/b19c9b/32.png) [@OlivierCR](https://discuss.huggingface.co/u/OlivierCR)\
**Post date:** [December 10, 2021, 7:33am UTC](https://discuss.huggingface.co/t/spot-instances-with-sagemaker-batch-transform/12681/2 "2021-12-10T07:33:03Z")

</div>

not possible today. If you want to use Spot for inference, you can write inference code as a custom python script and run inference in the Training API / HuggingFace Estimator 🙂
