How to fine-tune?

#10
by havardox - opened

Pretty basic question. How do I fine-tune the model in SentenceTransformers?

Hello!

You can use this snippet: https://huggingface.co/blog/train-sentence-transformers#trainer

But replace

# 1. Load a model to finetune with 2. (Optional) model card data
model = SentenceTransformer(
    "microsoft/mpnet-base",
    model_card_data=SentenceTransformerModelCardData(
        language="en",
        license="apache-2.0",
        model_name="MPNet base trained on AllNLI triplets",
    )
)

with

# 1. Load a model to finetune with 2. (Optional) model card data
model = SentenceTransformer(
    "Alibaba-NLP/gte-multilingual-base",
    trust_remote_code=True,
)

The rest of the blogpost should help explain what the code means.
There's more documentation here: https://sbert.net/docs/sentence_transformer/training_overview.html

  • Tom Aarsen

Sign up or log in to comment