Closed zynos closed 2 days ago
Hi @zynos Thanks for poining out this special case. The TransformerSmallerTrainingVocab needs to save the models again, as otherwise the vocabulary that was excluded from training would be missing later on. Beside that, it is inconsitend behaivour when the best-model is only loaded at the end iff you evaluate it on a test set. Hence I implemented your second suggestion here: https://github.com/flairNLP/flair/pull/3470
Thank you very much!
Describe the bug
in Flair version 0.13.1 we use the reduce_training_vocab_flag and provide no test_data so flair prints out:
log.info("Test data not provided setting final score to 0")
In the file flair/trainers/plugins/functional/reduce_transformer_vocab.py you can see that the plugin only checks if best model is available, and if so, it overwrites it with the currently loaded model.
So if you find the best model in epoch 3 of 10 and you provide no test data, this code will overwrite it with a worse model from epoch 10.
To Reproduce
This should be reproducable with all Ner datasets with missing test set.
Expected behavior
Either dont overwrite the best-model or load it also in case that there is no test set:
line 803 in flair/trainers/trainer.py
could be changed to
Logs and Stack traces
No response
Screenshots
No response
Additional Context
No response
Environment
Versions:
Flair
0.13.1
Pytorch
2.3.0+cu121
Transformers
4.41.0
GPU
True