🚀 センテンストランスフォーマー(FacebookAI/xlm-roberta-largeベース)
このモデルは、以前にリリースされた omarelshehy/arabic-english-sts-matryoshka の v2.0 バージョンです。
📊 このバージョンのメトリクス(MTEB)は、特に ar-en のメトリクスが改善されていますが、ただそれだけに頼るのではなく、自らモデルをテストして、自分のニーズに合うかどうかを確認してください! ✅
🚀 クイックスタート
このモデルは、FacebookAI/xlm-roberta-large からファインチューニングされた バイリンガル(アラビア語 - 英語) の sentence-transformers モデルです。文章や段落を1024次元の密ベクトル空間にマッピングし、意味的な文章の類似性、意味検索、パラフレーズマイニング、テキスト分類、クラスタリング などに使用できます。
モデルは両言語を別々に扱うだけでなく、相互に交換可能 であり、アラビア語モデルをさらに拡張したい開発者や研究者に柔軟なアプリケーションを提供します! 💡
✨ 主な機能
- このモデルはマトリョーシカ埋め込みをサポートしており、タスクの要件に基づいて埋め込みを小さなサイズに切り捨てることで、パフォーマンスとメモリ使用量を最適化できます。利用可能な切り捨てサイズは 1024、768、512、256、128、および64 です。
- ユースケースに適した埋め込みサイズを選択でき、リソース管理の柔軟性を確保します。
📦 インストール
まず、Sentence Transformersライブラリをインストールします。
pip install -U sentence-transformers
💻 使用例
基本的な使用法
次に、このモデルをロードして推論を実行できます。
from sentence_transformers import SentenceTransformer
matryoshka_dim = 786
model = SentenceTransformer("omarelshehy/arabic-english-sts-matryoshka-v2.0", truncate_dim=matryoshka_dim)
sentences = [
"She enjoyed reading books by the window as the rain poured outside.",
"كانت تستمتع بقراءة الكتب بجانب النافذة بينما كانت الأمطار تتساقط في الخارج.",
"Reading by the window was her favorite thing, especially during rainy days."
]
embeddings = model.encode(sentences)
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
📚 ドキュメント
モデル情報
メトリクス
- pearson_cosine
- spearman_cosine
- pearson_manhattan
- spearman_manhattan
- pearson_euclidean
- spearman_euclidean
- pearson_dot
- spearman_dot
- pearson_max
- spearman_max
モデルの結果
- モデル名: omarelshehy/arabic-english-sts-matryoshka-v2-checkpoint-375k
- データセット: MTEB STS17 (en-en, ar-ar, en-ar)
- タスク: STS
- 各データセットのメトリクス結果(コサインピアソン、コサインスピアマン、ユークリッドピアソンなど)は元のREADMEに記載されています。
📄 引用
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
MatryoshkaLoss
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
MultipleNegativesRankingLoss
@misc{henderson2017efficient,
title={Efficient Natural Language Response Suggestion for Smart Reply},
author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
year={2017},
eprint={1705.00652},
archivePrefix={arXiv},
primaryClass={cs.CL}
}