You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using intfloat/multilingual-e5-large for a retrieval task and I found that when E5OnnxEmbedding embeds texts using the model, the model output is pooled by CLS-pooling.
classE5OnnxEmbedding(OnnxTextEmbedding):
...
classOnnxTextEmbedding(TextEmbeddingBase, OnnxTextModel[np.ndarray]):
"""Implementation of the Flag Embedding model."""
...
def_post_process_onnx_output(self, output: OnnxOutputContext) ->Iterable[np.ndarray]:
embeddings=output.model_outputreturnnormalize(embeddings[:, 0]).astype(np.float32)
But I think it would be better to use average pooling as the paper does when pretraining the model.
Following the popular biencoder architecture, we use a pre-trained Transformer encoder and average pooling over the output layer to get fixed-size text embeddings Eq and Ep. The score is the cosine similarity scaled by a temperature hyperparameter τ : ...
So I'm alternatively using the model that uses average pooling by overriding E5OnnxEmbedding:
What happened?
Hi, I'm using
intfloat/multilingual-e5-large
for a retrieval task and I found that whenE5OnnxEmbedding
embeds texts using the model, the model output is pooled by CLS-pooling.But I think it would be better to use average pooling as the paper does when pretraining the model.
So I'm alternatively using the model that uses average pooling by overriding
E5OnnxEmbedding
:Would you consider changing the pooling method to average pooling?
And separated with this, I'm really enjoying using FastEmbed and I appreciate your work on it!
Thanks for your time and consideration!
What Python version are you on? e.g. python --version
Version
0.2.7 (Latest)
What os are you seeing the problem on?
MacOS
Relevant stack traces and/or logs
No response
The text was updated successfully, but these errors were encountered: