Pretraining with option --n-save-every still saves all models
See original GitHub issueI am running the following command:
!spacy pretrain $FILE_RF_SENTENCES en_core_sci_lg $DIR_MODELS_RF_SENT \
--use-vectors --n-save-every 5
In order to use less space, I specified the option --n-save-every
to save a model every X batches.
However, all models are still saved, with additional .temp.bin
files:
$ ls -al /kaggle/working/models/tok2vec_rf_sent_sci
[snip]
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model110.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model110.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model111.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model111.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model112.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model112.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model113.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model113.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model114.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model114.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model115.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model115.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model116.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model116.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model117.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model117.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model118.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model118.temp.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model119.bin
-rw-r--r-- 1 root root 3889626 Apr 9 08:49 model119.temp.bin
[snip]
Info about spaCy
- spaCy version: 2.2.4
- Platform: Linux-4.19.112±x86_64-with-debian-9.9
- Python version: 3.6.6
Notebook
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Don't Stop Pretraining: Adapt Language Models to ...
In light of the success of these broad-coverage models, we investigate whether it is still helpful to tailor a pretrained model to the...
Read more >Fine-tune a pretrained model
There are significant benefits to using a pretrained model. It reduces computation costs, your carbon footprint, and allows you to use state-of-the-art models...
Read more >Save and load Keras models | TensorFlow Core
Saving the weights values only. This is generally used when training the model. Let's take a look at each of these options. When...
Read more >How do pre-trained models work?
The intuition for using pretrained models. Now think about this. If you want to train a classifier, any classifier, the initial layers are...
Read more >Saving and Loading Models (Coding TensorFlow) - YouTube
Training models can take a very long time, and you definitely don't want to have to retrain everything over a single mishap.
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
This will be fixed in spaCy v.3 onwards, which will only save one best, and one final model.
[UPDATE]: I think the above comment wasn’t entirely correct. One best, final model is saved for normal training, not for pretraining. However, this PR should address the original issue discussed in this thread.
I agree that that would be a useful option: it would save disk space. You may still get a lot of models in the beginning of the training though, because usually the loss keeps dropping consistently in the first dozens of iterations at least. But you could give it a try and see how it works out.