Views
No views yet
SentenceTransformer(
(0): Transformer({'max_seq_length': 128, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
(2): Normalize()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("sultanbi/e5-base-kazakh")
5# Run inference
6sentences = [
7 'query: Ақ көйлек киген аққұба әйел гүлді ағашта ақ құсты ұстап отыр.',
8 'query: Балалар күлімсіреп, камераға қол бұлғап тұр.',
9 'query: Үш бала көл жағасында тұр.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 768]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]| Task / Dataset | Metric | multilingual-e5-base | e5-base-kazakh | Δ (absolute) | Description |
|---|---|---|---|---|---|
| Kazakh SNLI (validation set) retrieval | R@1 | 0.433 | 0.887 | +0.454 | Monolingual semantic retrieval on translated SNLI (validation set) |
| R@5 | 0.619 | 0.984 | +0.365 | ||
| R@10 | 0.710 | 0.994 | +0.284 | ||
| STS-B (val, Kazakh) | Pearson | 0.708 | 0.817 | +0.109 | Semantic similarity correlation (machine-translated STS-B) |
| Spearman | 0.721 | 0.825 | +0.104 | ||
| Triplet Accuracy | — | 0.802 | 0.941 | +0.139 | Monolingual entailment discrimination |
1@article{wang2024multilingual,
2 title={Multilingual E5 Text Embeddings: A Technical Report},
3 author={Wang, Liang and Yang, Nan and Huang, Xiaolong and Yang, Linjun and Majumder, Rangan and Wei, Furu},
4 journal={arXiv preprint arXiv:2402.05672},
5 year={2024}
6}1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}