hotchpotch
commited on
Commit
•
8165860
1
Parent(s):
90f621f
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
---
|
|
|
2 |
license: mit
|
3 |
datasets:
|
4 |
- hotchpotch/JQaRA
|
@@ -11,4 +12,110 @@ language:
|
|
11 |
library_name: sentence-transformers
|
12 |
---
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
|
3 |
license: mit
|
4 |
datasets:
|
5 |
- hotchpotch/JQaRA
|
|
|
12 |
library_name: sentence-transformers
|
13 |
---
|
14 |
|
15 |
+
## hotchpotch/japanese-bge-reranker-v2-m3-v1
|
16 |
+
|
17 |
+
日本語で学習させた Reranker (CrossEncoder) シリーズです。
|
18 |
+
|
19 |
+
| モデル名 | layers | hidden_size |
|
20 |
+
| ----------------------------------------------------------------------------------------------------------------------------------- | ------ | ----------- |
|
21 |
+
| [hotchpotch/japanese-reranker-cross-encoder-xsmall-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-xsmall-v1) | 6 | 384 |
|
22 |
+
| [hotchpotch/japanese-reranker-cross-encoder-small-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-small-v1) | 12 | 384 |
|
23 |
+
| [hotchpotch/japanese-reranker-cross-encoder-base-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-base-v1) | 12 | 768 |
|
24 |
+
| [hotchpotch/japanese-reranker-cross-encoder-large-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-large-v1) | 24 | 1024 |
|
25 |
+
| [hotchpotch/japanese-bge-reranker-v2-m3-v1](https://huggingface.co/hotchpotch/japanese-bge-reranker-v2-m3-v1) | 24 | 1024 |
|
26 |
+
|
27 |
+
Reranker についてや、技術レポート・評価等は以下を参考ください。
|
28 |
+
|
29 |
+
- [日本語最高性能のRerankerをリリース / そもそも Reranker とは?](https://secon.dev/entry/2024/04/02/070000-japanese-reranker-release/)
|
30 |
+
- [日本語 Reranker 作成のテクニカルレポート](https://secon.dev/entry/2024/04/02/080000-japanese-reranker-tech-report/)
|
31 |
+
|
32 |
+
|
33 |
+
## 使い方
|
34 |
+
|
35 |
+
### SentenceTransformers
|
36 |
+
|
37 |
+
```python
|
38 |
+
from sentence_transformers import CrossEncoder
|
39 |
+
import torch
|
40 |
+
|
41 |
+
MODEL_NAME = "hotchpotch/japanese-bge-reranker-v2-m3-v1"
|
42 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
43 |
+
model = CrossEncoder(MODEL_NAME, max_length=512, device=device)
|
44 |
+
if device == "cuda":
|
45 |
+
model.model.half()
|
46 |
+
query = "感動的な映画について"
|
47 |
+
passages = [
|
48 |
+
"深いテーマを持ちながらも、観る人の心を揺さぶる名作。登場人物の心情描写が秀逸で、ラストは涙なしでは見られない。",
|
49 |
+
"重要なメッセージ性は評価できるが、暗い話が続くので気分が落ち込んでしまった。もう少し明るい要素があればよかった。",
|
50 |
+
"どうにもリアリティに欠ける展開が気になった。もっと深みのある人間ドラマが見たかった。",
|
51 |
+
"アクションシーンが楽しすぎる。見ていて飽きない。ストーリーはシンプルだが、それが逆に良い。",
|
52 |
+
]
|
53 |
+
scores = model.predict([(query, passage) for passage in passages])
|
54 |
+
```
|
55 |
+
|
56 |
+
## HuggingFace transformers
|
57 |
+
|
58 |
+
```python
|
59 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
60 |
+
from torch.nn import Sigmoid
|
61 |
+
|
62 |
+
MODEL_NAME = "hotchpotch/japanese-bge-reranker-v2-m3-v1"
|
63 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
64 |
+
|
65 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
66 |
+
model = AutoModelForSequenceClassification.from_pretrained(MODEL_NAME)
|
67 |
+
model.to(device)
|
68 |
+
model.eval()
|
69 |
+
|
70 |
+
if device == "cuda":
|
71 |
+
model.half()
|
72 |
+
|
73 |
+
query = "感動的な映画について"
|
74 |
+
passages = [
|
75 |
+
"深いテーマを持ちながらも、観る人の心を揺さぶる名作。登場人物の心情描写が秀逸で、ラストは涙なしでは見られない。",
|
76 |
+
"重要なメッセージ性は評価できるが、暗い話が続くので気分が落ち込んでしまった。もう少し明るい要素があればよかった。",
|
77 |
+
"どうにもリアリティに欠ける展開が気になった。もっと深みのある人間ドラマが見たかった。",
|
78 |
+
"アクションシーンが楽しすぎる。見ていて飽きない。ストーリーはシンプルだが、それが逆に良い。",
|
79 |
+
]
|
80 |
+
inputs = tokenizer(
|
81 |
+
[(query, passage) for passage in passages],
|
82 |
+
padding=True,
|
83 |
+
truncation=True,
|
84 |
+
max_length=512,
|
85 |
+
return_tensors="pt",
|
86 |
+
)
|
87 |
+
inputs = {k: v.to(device) for k, v in inputs.items()}
|
88 |
+
logits = model(**inputs).logits
|
89 |
+
activation = Sigmoid()
|
90 |
+
scores = activation(logits).squeeze().tolist()
|
91 |
+
```
|
92 |
+
|
93 |
+
## 評価結果
|
94 |
+
|
95 |
+
| Model Name | [JQaRA](https://huggingface.co/datasets/hotchpotch/JQaRA) | [JaCWIR](https://huggingface.co/datasets/hotchpotch/JaCWIR) | [MIRACL](https://huggingface.co/datasets/miracl/miracl) | [JSQuAD](https://github.com/yahoojapan/JGLUE) |
|
96 |
+
| ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------- | --------------------------------------------- |
|
97 |
+
| [japanese-reranker-cross-encoder-xsmall-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-xsmall-v1) | 0.6136 | 0.9376 | 0.7411 | 0.9602 |
|
98 |
+
| [japanese-reranker-cross-encoder-small-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-small-v1) | 0.6247 | 0.939 | 0.7776 | 0.9604 |
|
99 |
+
| [japanese-reranker-cross-encoder-base-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-base-v1) | 0.6711 | 0.9337 | 0.818 | 0.9708 |
|
100 |
+
| [japanese-reranker-cross-encoder-large-v1](https://huggingface.co/hotchpotch/japanese-reranker-cross-encoder-large-v1) | 0.7099 | 0.9364 | 0.8406 | 0.9773 |
|
101 |
+
| [japanese-bge-reranker-v2-m3-v1](https://huggingface.co/hotchpotch/japanese-bge-reranker-v2-m3-v1) | 0.6918 | 0.9372 | 0.8423 | 0.9624 |
|
102 |
+
| [bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) | 0.673 | 0.9343 | 0.8374 | 0.9599 |
|
103 |
+
| [bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) | 0.4718 | 0.7332 | 0.7666 | 0.7081 |
|
104 |
+
| [bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) | 0.2445 | 0.4905 | 0.6792 | 0.5757 |
|
105 |
+
| [cross-encoder-mmarco-mMiniLMv2-L12-H384-v1](https://huggingface.co/corrius/cross-encoder-mmarco-mMiniLMv2-L12-H384-v1) | 0.5588 | 0.9211 | 0.7158 | 0.932 |
|
106 |
+
| [shioriha-large-reranker](https://huggingface.co/cl-nagoya/shioriha-large-reranker) | 0.5775 | 0.8458 | 0.8084 | 0.9262 |
|
107 |
+
| [bge-m3+all](https://huggingface.co/BAAI/bge-m3) | 0.576 | 0.904 | 0.7926 | 0.9226 |
|
108 |
+
| [bge-m3+dense](https://huggingface.co/BAAI/bge-m3) | 0.539 | 0.8642 | 0.7753 | 0.8815 |
|
109 |
+
| [bge-m3+colbert](https://huggingface.co/BAAI/bge-m3) | 0.5656 | 0.9064 | 0.7902 | 0.9297 |
|
110 |
+
| [bge-m3+sparse](https://huggingface.co/BAAI/bge-m3) | 0.5088 | 0.8944 | 0.6941 | 0.9184 |
|
111 |
+
| [JaColBERTv2](https://huggingface.co/bclavie/JaColBERTv2) | 0.5847 | 0.9185 | 0.6861 | 0.9247 |
|
112 |
+
| [multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) | 0.554 | 0.8759 | 0.7722 | 0.8892 |
|
113 |
+
| [multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) | 0.4917 | 0.869 | 0.7025 | 0.8565 |
|
114 |
+
| bm25 | 0.458 | 0.8408 | 0.4387 | 0.9002 |
|
115 |
+
|
116 |
+
|
117 |
+
## ライセンス
|
118 |
+
|
119 |
+
MIT License
|
120 |
+
|
121 |
+
|