Find answers from the community

Updated 2 months ago

Finetuning

Hello,
After i finetune my embedding model, do you know how can i save it locally ?
i'm using SentenceTransformersFinetuneEngine to finetune it.
Thanks in advance
W
E
5 comments
I think it is stored at the output path defined by you after finetuning is done.
Plain Text
finetune_engine = SentenceTransformersFinetuneEngine(
    train_dataset,
    model_id="BAAI/bge-small-en",
    model_output_path="test_model", # This should be the place where your model should be stored
    val_dataset=val_dataset,
)

https://github.com/run-llama/llama_index/blob/fc28449aa988a0c184a23c046b35b2406ca35310/llama_index/finetuning/embeddings/sentence_transformer.py#L73
thanks a lot @WhiteFang_Jr ! And do you know how do i load it after ?
i saw the method get_finetuned_model in SentenceTransformersFinetuneEngine but it requires to training dataset
No I think it does not require the training dataset. Once you have trained the model. You can simply pull it using the method that you mentioned if you are in the same session. And if not then I guess

Plain Text
service_context = ServiceContext.from_defaults(embed_model="local:YOUR_MODEL_NAME,llm=llm)
This should work
awesome πŸ™‚
Add a reply
Sign up and join the conversation on Discord