Specify add_pooling_layer=False via configuration instead
Hello!
Pull Request overview
- Specify add_pooling_layer=False via configuration instead
Details
The underlying transformers AutoModel
should be called with add_pooling_layer=False
to avoid confusing warnings. This can be done directly via the SentenceTransformer
init, but we can also define a default in the sentence_bert_config.json
. In short, the values in that config file get passed to the Transformer init, so we can specify all kinds of values in our config, e.g. model_args, tokenizer_args, config-args, max_seq_length, etc.
By setting the new default in the config, less people should experience this warning.
Note: This does mean that this model can only be loaded with SentenceTransformer v3 and up (but this was already required for the remainder of the README.md snippet regardless).
Note 2: Looks like we do the same already in the v1: https://huggingface.co/Snowflake/snowflake-arctic-embed-m/blob/main/sentence_bert_config.json#L4-L6
- Tom Aarsen