UKPLab / sentence-transformers

Multilingual Sentence & Image Embeddings with BERT
https://www.SBERT.net
Apache License 2.0
14.73k stars 2.43k forks source link

What is 'sentence_embedding' of a Sentence Transformer Model? #753

Open PaulForInvent opened 3 years ago

PaulForInvent commented 3 years ago

Hey, I try to understand where this comes from. It is just mentioned here link

But seems not be used anywhere than. Because this feature is used in the losses like OnlineContrastive. I don't hink it comes from the huggingface model?

To which forward is this here referring to?

I also wonder what this _modules is like here.

Why is this not in the init?

Thanks. :-)

nreimers commented 3 years ago

the 'sentence_embedding' entry is added by the pooling layer.

The _modules come from torch.nn.Sequential. It stores all the modules in the sequential network architecture.