sentence-similarityhuggingfacesentence-transformers

How to save a SetFit trainer locally after training


I am working on an HPC with no internet access on worker nodes and the only option to save a SetFit trainer after training, is to push it to HuggingFace hub. How do I go about saving it locally to disk?

https://github.com/huggingface/setfit


Solution

  • setfit has this class method

    model._save_pretrained(save_directory)
    

    and to load it

    saved_model = SetFitModel._from_pretrained(save_directory)