Views
No views yet
| ID | #Param. | #Param. w/o Emb. | Dim. | #Layers | Avg. JMTEB |
|---|---|---|---|---|---|
| cl-nagoya/ruri-v3-30m | 37M | 10M | 256 | 10 | 74.51 |
| cl-nagoya/ruri-v3-70m | 70M | 31M | 384 | 13 | 75.48 |
| cl-nagoya/ruri-v3-130m | 132M | 80M | 512 | 19 | 76.55 |
| cl-nagoya/ruri-v3-310m | 315M | 236M | 768 | 25 | 77.24 |
pip install -U "transformers>=4.48.0" sentence-transformerspip install flash-attn --no-build-isolation1import torch.nn.functional as F
2from sentence_transformers import SentenceTransformer
3
4# Download from the 🤗 Hub
5model = SentenceTransformer("cl-nagoya/ruri-v3-pt-310m")
6
7# Ruri v3 employs a 1+3 prefix scheme to distinguish between different types of text inputs:
8# "" (empty string) is used for encoding semantic meaning.
9# "トピック: " is used for classification, clustering, and encoding topical information.
10# "検索クエリ: " is used for queries in retrieval tasks.
11# "検索文書: " is used for documents to be retrieved.
12sentences = [
13 "川べりでサーフボードを持った人たちがいます",
14 "サーファーたちが川べりに立っています",
15 "トピック: 瑠璃色のサーファー",
16 "検索クエリ: 瑠璃色はどんな色?",
17 "検索文書: 瑠璃色(るりいろ)は、紫みを帯びた濃い青。名は、半貴石の瑠璃(ラピスラズリ、英: lapis lazuli)による。JIS慣用色名では「こい紫みの青」(略号 dp-pB)と定義している[1][2]。",
18]
19
20embeddings = model.encode(sentences, convert_to_tensor=True)
21print(embeddings.size())
22# [5, 768]
23
24similarities = F.cosine_similarity(embeddings.unsqueeze(0), embeddings.unsqueeze(1), dim=2)
25print(similarities)1@misc{
2 Ruri,
3 title={{Ruri: Japanese General Text Embeddings}},
4 author={Hayato Tsukagoshi and Ryohei Sasano},
5 year={2024},
6 eprint={2409.07737},
7 archivePrefix={arXiv},
8 primaryClass={cs.CL},
9 url={https://arxiv.org/abs/2409.07737},
10}