# Fine-tune sentence transformer model on SageMaker

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tune-sentence-transformer-model-on-sagemaker%2F28253%3E%5C
**Category:** Amazon SageMaker\
**Created:** [December 21, 2022, 9:25pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tune-sentence-transformer-model-on-sagemaker%2F28253 "2022-12-21T21:25:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bachmitre](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@bachmitre](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbachmitre)%5C
**Post date:** [December 21, 2022, 9:25pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ffine-tune-sentence-transformer-model-on-sagemaker%2F28253%2F1 "2022-12-21T21:25:27Z")

</div>

I am trying to fine-tune a sentence transformer model (specifically ‘sentence-transformers/all-MiniLM-L6-v2’) using AWS SageMaker to later deploy the fine tuned model to an inference endpoint.

I have previously used the `sentence_transformers` library with `InputExamples`, `losses` and `SentenceTransformer.fit()` for fine-tuning, but now want to move this into a SageMaker training job.

From what I am seeing, I have to create a `train.py` script that uses the `transformers.Trainer`.  
I have seen multiple versions of the `train.py` script, but none of which fine-tunes a sentence transformer.

Any example or hint on how to proceed would be much appreciated.
