Save Model Locally trainer.save_model()
See original GitHub issueFirst off, super excited about all this work! Also really appreciate the youtube presentation and the blogpost, super insightful to read through. I went through the existing issues and couldn’t find whether this an existing functionality:
Is there a way to save the model locally instead of pushing to the hub?
So in addition to this:
trainer.push_to_hub(f"setfit-myowndataset-multilabel-example")
be able to do this too:
trainer.save_model("file-path/setfit-myowndatase-multilabel-example")
Issue Analytics
- State:
- Created 10 months ago
- Reactions:4
- Comments:5
Top Results From Across the Web
How to save my model to use it later - Hugging Face Forums
You can save models with trainer.save_model("path_to_save") . Another cool thing you can do is you can push your model to the Hugging Face...
Read more >Save and load models | TensorFlow Core
Model progress can be saved during and after training. This means a model can resume where it left off and avoid long training...
Read more >Saving, Loading, Downloading, and Uploading Models
In R and Python, you can save a model locally or to HDFS using the h2o.saveModel (R) or h2o.save_model (Python) function . This...
Read more >Saving and Loading Models - PyTorch
To load the items, first initialize the model and optimizer, then load the dictionary locally using torch.load() . From here, you can easily...
Read more >huggingface transformers - saving finetuned model locally
1 Answer 1 · is this different from Trainer.save_model() , i.e. does it save the same thing? · 1. @yulGM, yes that should...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It can be done by trainer.model._save_pretrained(save_directory=save_directory).
Here is the link to the solution where it has already been answered - https://github.com/huggingface/setfit/issues/102
You should be able to do
model.save(path_str)
as usual.https://github.com/huggingface/setfit/blob/5313939b638b57668a1b5a67ef600e54da221d9a/src/setfit/modeling.py#L579
or if your model is not wrapped,
model._save_pretrained(path_str)
.