# Spot instances with Sagemaker batch transform?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fspot-instances-with-sagemaker-batch-transform%2F12681%3E%5C
**Category:** Amazon SageMaker\
**Created:** [December 9, 2021, 11:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fspot-instances-with-sagemaker-batch-transform%2F12681 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FMaximusDecimusMeridi)%5C
**Post date:** [December 9, 2021, 11:26pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fspot-instances-with-sagemaker-batch-transform%2F12681%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FOlivierCR)%5C
**Post date:** [December 10, 2021, 7:33am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fspot-instances-with-sagemaker-batch-transform%2F12681%2F2 "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 🙂
