Patch Sentence Transformers integration
#2
by
tomaarsen
HF staff
- opened
Hello!
Congratulations on your release! Well done π
Pull Request overview
- Patch Sentence Transformers integration, in particular:
- Rename "1_Pool" to "1_Pooling": the latter is referenced in
modules.json
and will be used to load the pooling configuration. - Update the pooling configuration to also include the prompt in the pooling. This previously resulted in a slight difference between
transformers
andsentence-transformers
.
- Rename "1_Pool" to "1_Pooling": the latter is referenced in
- Simplified the code snippet:
- max_seq_length is now defined in
sentence_bert_config.json
. - a
Normalize
module is added inmodules.json
, which means that all outputs will be normalized even without specifyingnormalize_embeddings=True
.
- max_seq_length is now defined in
- Add instructions to the
prompts
dictionary inconfig_sentence_transformers.json
. This allows formodel.encode(my_texts, prompt_name="nq")
- Add a
sentence-transformers
tag, making the model easier to find when searching for embedding models under https://huggingface.co/models?library=sentence-transformers&sort=trending
Details
I ran the updated script in the README, and it gave me [[0.35365450382232666, 0.18592746555805206]]
, which is the same as what I get when running the transformers
snippet.
- Tom Aarsen
tomaarsen
changed pull request status to
open
Kaguya-19
changed pull request status to
merged
Thank you!
Thank you for your helpful work!