Sentence Similarity
Safetensors
Japanese
RAGatouille
bert
ColBERT

Fix architectures field, add Sentence Transformers usage

#2
by tomaarsen HF Staff - opened
Files changed (2) hide show
  1. README.md +34 -0
  2. config.json +1 -1
README.md CHANGED
@@ -8,6 +8,8 @@ language:
8
  pipeline_tag: sentence-similarity
9
  tags:
10
  - ColBERT
 
 
11
  base_model:
12
  - cl-tohoku/bert-base-japanese-v3
13
  - bclavie/JaColBERT
@@ -21,6 +23,38 @@ This model largely outperforms all previous approaches, including JaColBERTV2 mu
21
 
22
  This page will be updated with the full details and the model report in the next few days.
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  ```
25
  @misc{clavié2024jacolbertv25optimisingmultivectorretrievers,
26
  title={JaColBERTv2.5: Optimising Multi-Vector Retrievers to Create State-of-the-Art Japanese Retrievers with Constrained Resources},
 
8
  pipeline_tag: sentence-similarity
9
  tags:
10
  - ColBERT
11
+ - multi-vector
12
+ - sentence-transformers
13
  base_model:
14
  - cl-tohoku/bert-base-japanese-v3
15
  - bclavie/JaColBERT
 
23
 
24
  This page will be updated with the full details and the model report in the next few days.
25
 
26
+ ## Sentence Transformers
27
+
28
+ As of [Sentence Transformers](https://www.sbert.net/) v6.0.0, this model can also be loaded directly as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
29
+
30
+ ```bash
31
+ pip install "sentence-transformers>=6.0.0" fugashi unidic-lite
32
+ ```
33
+
34
+ ```python
35
+ from sentence_transformers import MultiVectorEncoder
36
+
37
+ model = MultiVectorEncoder("answerdotai/JaColBERTv2.4")
38
+
39
+ query = "日本で一番高い山は何ですか?"
40
+ documents = [
41
+ "富士山は日本で最も高い山で、標高は3776メートルです。",
42
+ "東京は日本の首都で、世界最大の都市圏の一つです。",
43
+ "北岳は南アルプスにある山で、日本で二番目に高い山です。",
44
+ "富士山は静岡県と山梨県にまたがる活火山です。",
45
+ ]
46
+
47
+ query_embeddings = model.encode_query(query)
48
+ document_embeddings = model.encode_document(documents)
49
+ print(query_embeddings.shape, document_embeddings[0].shape)
50
+ # torch.Size([32, 128]) torch.Size([21, 128])
51
+
52
+ # MaxSim late-interaction scoring (higher is more relevant)
53
+ scores = model.similarity(query_embeddings, document_embeddings)
54
+ print(scores)
55
+ # tensor([[30.6411, 28.8692, 29.7601, 28.9441]], device='cuda:0')
56
+ ```
57
+
58
  ```
59
  @misc{clavié2024jacolbertv25optimisingmultivectorretrievers,
60
  title={JaColBERTv2.5: Optimising Multi-Vector Retrievers to Create State-of-the-Art Japanese Retrievers with Constrained Resources},
config.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "_name_or_path": "./step_48003",
3
  "architectures": [
4
- "BertModel"
5
  ],
6
  "attention_probs_dropout_prob": 0.1,
7
  "classifier_dropout": null,
 
1
  {
2
  "_name_or_path": "./step_48003",
3
  "architectures": [
4
+ "HF_ColBERT"
5
  ],
6
  "attention_probs_dropout_prob": 0.1,
7
  "classifier_dropout": null,