srikanthmalla Shitao commited on
Commit
0fb5ba4
0 Parent(s):

Duplicate from BAAI/bge-reranker-large

Browse files

Co-authored-by: Xiao <Shitao@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ onnx/model.onnx_data filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,528 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zh
5
+ - en
6
+
7
+ tags:
8
+ - mteb
9
+ model-index:
10
+ - name: bge-reranker-large
11
+ results:
12
+ - task:
13
+ type: Reranking
14
+ dataset:
15
+ type: C-MTEB/CMedQAv1-reranking
16
+ name: MTEB CMedQAv1
17
+ config: default
18
+ split: test
19
+ revision: None
20
+ metrics:
21
+ - type: map
22
+ value: 82.13813829648727
23
+ - type: mrr
24
+ value: 84.92349206349207
25
+ - task:
26
+ type: Reranking
27
+ dataset:
28
+ type: C-MTEB/CMedQAv2-reranking
29
+ name: MTEB CMedQAv2
30
+ config: default
31
+ split: test
32
+ revision: None
33
+ metrics:
34
+ - type: map
35
+ value: 84.19313276771856
36
+ - type: mrr
37
+ value: 86.96876984126984
38
+ - task:
39
+ type: Reranking
40
+ dataset:
41
+ type: C-MTEB/Mmarco-reranking
42
+ name: MTEB MMarcoReranking
43
+ config: default
44
+ split: dev
45
+ revision: None
46
+ metrics:
47
+ - type: map
48
+ value: 37.16533876035345
49
+ - type: mrr
50
+ value: 36.60039682539682
51
+ - task:
52
+ type: Reranking
53
+ dataset:
54
+ type: C-MTEB/T2Reranking
55
+ name: MTEB T2Reranking
56
+ config: default
57
+ split: dev
58
+ revision: None
59
+ metrics:
60
+ - type: map
61
+ value: 67.60068968300665
62
+ - type: mrr
63
+ value: 77.68363585560605
64
+ ---
65
+
66
+
67
+ <h1 align="center">FlagEmbedding</h1>
68
+
69
+
70
+ <h4 align="center">
71
+ <p>
72
+ <a href=#model-list>Model List</a> |
73
+ <a href=#frequently-asked-questions>FAQ</a> |
74
+ <a href=#usage>Usage</a> |
75
+ <a href="#evaluation">Evaluation</a> |
76
+ <a href="#train">Train</a> |
77
+ <a href="#contact">Contact</a> |
78
+ <a href="#citation">Citation</a> |
79
+ <a href="#license">License</a>
80
+ <p>
81
+ </h4>
82
+
83
+ More details please refer to our Github: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding).
84
+
85
+
86
+ [English](README.md) | [中文](https://github.com/FlagOpen/FlagEmbedding/blob/master/README_zh.md)
87
+
88
+ FlagEmbedding focuses on retrieval-augmented LLMs, consisting of the following projects currently:
89
+
90
+ - **Long-Context LLM**: [Activation Beacon](https://github.com/FlagOpen/FlagEmbedding/tree/master/Long_LLM/activation_beacon)
91
+ - **Fine-tuning of LM** : [LM-Cocktail](https://github.com/FlagOpen/FlagEmbedding/tree/master/LM_Cocktail)
92
+ - **Dense Retrieval**: [BGE-M3](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/BGE_M3), [LLM Embedder](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/llm_embedder), [BGE Embedding](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/baai_general_embedding)
93
+ - **Reranker Model**: [BGE Reranker](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/reranker)
94
+ - **Benchmark**: [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB)
95
+
96
+ ## News
97
+ - 1/30/2024: Release **BGE-M3**, a new member to BGE model series! M3 stands for **M**ulti-linguality (100+ languages), **M**ulti-granularities (input length up to 8192), **M**ulti-Functionality (unification of dense, lexical, multi-vec/colbert retrieval).
98
+ It is the first embedding model which supports all three retrieval methods, achieving new SOTA on multi-lingual (MIRACL) and cross-lingual (MKQA) benchmarks.
99
+ [Technical Report](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/BGE_M3/BGE_M3.pdf) and [Code](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/BGE_M3). :fire:
100
+ - 1/9/2024: Release [Activation-Beacon](https://github.com/FlagOpen/FlagEmbedding/tree/master/Long_LLM/activation_beacon), an effective, efficient, compatible, and low-cost (training) method to extend the context length of LLM. [Technical Report](https://arxiv.org/abs/2401.03462) :fire:
101
+ - 12/24/2023: Release **LLaRA**, a LLaMA-7B based dense retriever, leading to state-of-the-art performances on MS MARCO and BEIR. Model and code will be open-sourced. Please stay tuned. [Technical Report](https://arxiv.org/abs/2312.15503) :fire:
102
+ - 11/23/2023: Release [LM-Cocktail](https://github.com/FlagOpen/FlagEmbedding/tree/master/LM_Cocktail), a method to maintain general capabilities during fine-tuning by merging multiple language models. [Technical Report](https://arxiv.org/abs/2311.13534) :fire:
103
+ - 10/12/2023: Release [LLM-Embedder](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/llm_embedder), a unified embedding model to support diverse retrieval augmentation needs for LLMs. [Technical Report](https://arxiv.org/pdf/2310.07554.pdf)
104
+ - 09/15/2023: The [technical report](https://arxiv.org/pdf/2309.07597.pdf) of BGE has been released
105
+ - 09/15/2023: The [massive training data](https://data.baai.ac.cn/details/BAAI-MTP) of BGE has been released
106
+ - 09/12/2023: New models:
107
+ - **New reranker model**: release cross-encoder models `BAAI/bge-reranker-base` and `BAAI/bge-reranker-large`, which are more powerful than embedding model. We recommend to use/fine-tune them to re-rank top-k documents returned by embedding models.
108
+ - **update embedding model**: release `bge-*-v1.5` embedding model to alleviate the issue of the similarity distribution, and enhance its retrieval ability without instruction.
109
+
110
+
111
+ <details>
112
+ <summary>More</summary>
113
+ <!-- ### More -->
114
+
115
+ - 09/07/2023: Update [fine-tune code](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md): Add script to mine hard negatives and support adding instruction during fine-tuning.
116
+ - 08/09/2023: BGE Models are integrated into **Langchain**, you can use it like [this](#using-langchain); C-MTEB **leaderboard** is [available](https://huggingface.co/spaces/mteb/leaderboard).
117
+ - 08/05/2023: Release base-scale and small-scale models, **best performance among the models of the same size 🤗**
118
+ - 08/02/2023: Release `bge-large-*`(short for BAAI General Embedding) Models, **rank 1st on MTEB and C-MTEB benchmark!** :tada: :tada:
119
+ - 08/01/2023: We release the [Chinese Massive Text Embedding Benchmark](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB) (**C-MTEB**), consisting of 31 test dataset.
120
+
121
+ </details>
122
+
123
+
124
+ ## Model List
125
+
126
+ `bge` is short for `BAAI general embedding`.
127
+
128
+ | Model | Language | | Description | query instruction for retrieval [1] |
129
+ |:-------------------------------|:--------:| :--------:| :--------:|:--------:|
130
+ | [BAAI/bge-m3](https://huggingface.co/BAAI/bge-m3) | Multilingual | [Inference](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/BGE_M3#usage) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/BGE_M3) | Multi-Functionality(dense retrieval, sparse retrieval, multi-vector(colbert)), Multi-Linguality, and Multi-Granularity(8192 tokens) | |
131
+ | [BAAI/llm-embedder](https://huggingface.co/BAAI/llm-embedder) | English | [Inference](./FlagEmbedding/llm_embedder/README.md) [Fine-tune](./FlagEmbedding/llm_embedder/README.md) | a unified embedding model to support diverse retrieval augmentation needs for LLMs | See [README](./FlagEmbedding/llm_embedder/README.md) |
132
+ | [BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) | Chinese and English | [Inference](#usage-for-reranker) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/reranker) | a cross-encoder model which is more accurate but less efficient [2] | |
133
+ | [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) | Chinese and English | [Inference](#usage-for-reranker) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/reranker) | a cross-encoder model which is more accurate but less efficient [2] | |
134
+ | [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `Represent this sentence for searching relevant passages: ` |
135
+ | [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `Represent this sentence for searching relevant passages: ` |
136
+ | [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `Represent this sentence for searching relevant passages: ` |
137
+ | [BAAI/bge-large-zh-v1.5](https://huggingface.co/BAAI/bge-large-zh-v1.5) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `为这个句子生成表示以用于检索相关文章:` |
138
+ | [BAAI/bge-base-zh-v1.5](https://huggingface.co/BAAI/bge-base-zh-v1.5) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `为这个句子生成表示以用于检索相关文章:` |
139
+ | [BAAI/bge-small-zh-v1.5](https://huggingface.co/BAAI/bge-small-zh-v1.5) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | version 1.5 with more reasonable similarity distribution | `为这个句子生成表示以用于检索相关文章:` |
140
+ | [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | :trophy: rank **1st** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
141
+ | [BAAI/bge-base-en](https://huggingface.co/BAAI/bge-base-en) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | a base-scale model but with similar ability to `bge-large-en` | `Represent this sentence for searching relevant passages: ` |
142
+ | [BAAI/bge-small-en](https://huggingface.co/BAAI/bge-small-en) | English | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) |a small-scale model but with competitive performance | `Represent this sentence for searching relevant passages: ` |
143
+ | [BAAI/bge-large-zh](https://huggingface.co/BAAI/bge-large-zh) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | :trophy: rank **1st** in [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/C_MTEB) benchmark | `为这个句子生成表示以用于检索相关文章:` |
144
+ | [BAAI/bge-base-zh](https://huggingface.co/BAAI/bge-base-zh) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | a base-scale model but with similar ability to `bge-large-zh` | `为这个句子生成表示以用于检索相关文章:` |
145
+ | [BAAI/bge-small-zh](https://huggingface.co/BAAI/bge-small-zh) | Chinese | [Inference](#usage-for-embedding-model) [Fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) | a small-scale model but with competitive performance | `为这个句子生成表示以用于检索相关文章:` |
146
+
147
+
148
+ [1\]: If you need to search the relevant passages to a query, we suggest to add the instruction to the query; in other cases, no instruction is needed, just use the original query directly. In all cases, **no instruction** needs to be added to passages.
149
+
150
+ [2\]: Different from embedding model, reranker uses question and document as input and directly output similarity instead of embedding. To balance the accuracy and time cost, cross-encoder is widely used to re-rank top-k documents retrieved by other simple models.
151
+ For examples, use bge embedding model to retrieve top 100 relevant documents, and then use bge reranker to re-rank the top 100 document to get the final top-3 results.
152
+
153
+ All models have been uploaded to Huggingface Hub, and you can see them at https://huggingface.co/BAAI.
154
+ If you cannot open the Huggingface Hub, you also can download the models at https://model.baai.ac.cn/models .
155
+
156
+
157
+ ## Frequently asked questions
158
+
159
+ <details>
160
+ <summary>1. How to fine-tune bge embedding model?</summary>
161
+
162
+ <!-- ### How to fine-tune bge embedding model? -->
163
+ Following this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune) to prepare data and fine-tune your model.
164
+ Some suggestions:
165
+ - Mine hard negatives following this [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune#hard-negatives), which can improve the retrieval performance.
166
+ - If you pre-train bge on your data, the pre-trained model cannot be directly used to calculate similarity, and it must be fine-tuned with contrastive learning before computing similarity.
167
+ - If the accuracy of the fine-tuned model is still not high, it is recommended to use/fine-tune the cross-encoder model (bge-reranker) to re-rank top-k results. Hard negatives also are needed to fine-tune reranker.
168
+
169
+
170
+ </details>
171
+
172
+ <details>
173
+ <summary>2. The similarity score between two dissimilar sentences is higher than 0.5</summary>
174
+
175
+ <!-- ### The similarity score between two dissimilar sentences is higher than 0.5 -->
176
+ **Suggest to use bge v1.5, which alleviates the issue of the similarity distribution.**
177
+
178
+ Since we finetune the models by contrastive learning with a temperature of 0.01,
179
+ the similarity distribution of the current BGE model is about in the interval \[0.6, 1\].
180
+ So a similarity score greater than 0.5 does not indicate that the two sentences are similar.
181
+
182
+ For downstream tasks, such as passage retrieval or semantic similarity,
183
+ **what matters is the relative order of the scores, not the absolute value.**
184
+ If you need to filter similar sentences based on a similarity threshold,
185
+ please select an appropriate similarity threshold based on the similarity distribution on your data (such as 0.8, 0.85, or even 0.9).
186
+
187
+ </details>
188
+
189
+ <details>
190
+ <summary>3. When does the query instruction need to be used</summary>
191
+
192
+ <!-- ### When does the query instruction need to be used -->
193
+
194
+ For the `bge-*-v1.5`, we improve its retrieval ability when not using instruction.
195
+ No instruction only has a slight degradation in retrieval performance compared with using instruction.
196
+ So you can generate embedding without instruction in all cases for convenience.
197
+
198
+ For a retrieval task that uses short queries to find long related documents,
199
+ it is recommended to add instructions for these short queries.
200
+ **The best method to decide whether to add instructions for queries is choosing the setting that achieves better performance on your task.**
201
+ In all cases, the documents/passages do not need to add the instruction.
202
+
203
+ </details>
204
+
205
+
206
+ ## Usage
207
+
208
+ ### Usage for Embedding Model
209
+
210
+ Here are some examples for using `bge` models with
211
+ [FlagEmbedding](#using-flagembedding), [Sentence-Transformers](#using-sentence-transformers), [Langchain](#using-langchain), or [Huggingface Transformers](#using-huggingface-transformers).
212
+
213
+ #### Using FlagEmbedding
214
+ ```
215
+ pip install -U FlagEmbedding
216
+ ```
217
+ If it doesn't work for you, you can see [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md) for more methods to install FlagEmbedding.
218
+
219
+ ```python
220
+ from FlagEmbedding import FlagModel
221
+ sentences_1 = ["样例数据-1", "样例数据-2"]
222
+ sentences_2 = ["样例数据-3", "样例数据-4"]
223
+ model = FlagModel('BAAI/bge-large-zh-v1.5',
224
+ query_instruction_for_retrieval="为这个句子生成表示以用于检索相关文章:",
225
+ use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
226
+ embeddings_1 = model.encode(sentences_1)
227
+ embeddings_2 = model.encode(sentences_2)
228
+ similarity = embeddings_1 @ embeddings_2.T
229
+ print(similarity)
230
+
231
+ # for s2p(short query to long passage) retrieval task, suggest to use encode_queries() which will automatically add the instruction to each query
232
+ # corpus in retrieval task can still use encode() or encode_corpus(), since they don't need instruction
233
+ queries = ['query_1', 'query_2']
234
+ passages = ["样例文档-1", "样例文档-2"]
235
+ q_embeddings = model.encode_queries(queries)
236
+ p_embeddings = model.encode(passages)
237
+ scores = q_embeddings @ p_embeddings.T
238
+ ```
239
+ For the value of the argument `query_instruction_for_retrieval`, see [Model List](https://github.com/FlagOpen/FlagEmbedding/tree/master#model-list).
240
+
241
+ By default, FlagModel will use all available GPUs when encoding. Please set `os.environ["CUDA_VISIBLE_DEVICES"]` to select specific GPUs.
242
+ You also can set `os.environ["CUDA_VISIBLE_DEVICES"]=""` to make all GPUs unavailable.
243
+
244
+
245
+ #### Using Sentence-Transformers
246
+
247
+ You can also use the `bge` models with [sentence-transformers](https://www.SBERT.net):
248
+
249
+ ```
250
+ pip install -U sentence-transformers
251
+ ```
252
+ ```python
253
+ from sentence_transformers import SentenceTransformer
254
+ sentences_1 = ["样例数据-1", "样例数据-2"]
255
+ sentences_2 = ["样例数据-3", "样例数据-4"]
256
+ model = SentenceTransformer('BAAI/bge-large-zh-v1.5')
257
+ embeddings_1 = model.encode(sentences_1, normalize_embeddings=True)
258
+ embeddings_2 = model.encode(sentences_2, normalize_embeddings=True)
259
+ similarity = embeddings_1 @ embeddings_2.T
260
+ print(similarity)
261
+ ```
262
+ For s2p(short query to long passage) retrieval task,
263
+ each short query should start with an instruction (instructions see [Model List](https://github.com/FlagOpen/FlagEmbedding/tree/master#model-list)).
264
+ But the instruction is not needed for passages.
265
+ ```python
266
+ from sentence_transformers import SentenceTransformer
267
+ queries = ['query_1', 'query_2']
268
+ passages = ["样例文档-1", "样例文档-2"]
269
+ instruction = "为这个句子生成表示以用于检索相关文章:"
270
+
271
+ model = SentenceTransformer('BAAI/bge-large-zh-v1.5')
272
+ q_embeddings = model.encode([instruction+q for q in queries], normalize_embeddings=True)
273
+ p_embeddings = model.encode(passages, normalize_embeddings=True)
274
+ scores = q_embeddings @ p_embeddings.T
275
+ ```
276
+
277
+ #### Using Langchain
278
+
279
+ You can use `bge` in langchain like this:
280
+ ```python
281
+ from langchain.embeddings import HuggingFaceBgeEmbeddings
282
+ model_name = "BAAI/bge-large-en-v1.5"
283
+ model_kwargs = {'device': 'cuda'}
284
+ encode_kwargs = {'normalize_embeddings': True} # set True to compute cosine similarity
285
+ model = HuggingFaceBgeEmbeddings(
286
+ model_name=model_name,
287
+ model_kwargs=model_kwargs,
288
+ encode_kwargs=encode_kwargs,
289
+ query_instruction="为这个句子生成表示以用于检索相关文章:"
290
+ )
291
+ model.query_instruction = "为这个句子生成表示以用于检索相关文章:"
292
+ ```
293
+
294
+
295
+ #### Using HuggingFace Transformers
296
+
297
+ With the transformers package, you can use the model like this: First, you pass your input through the transformer model, then you select the last hidden state of the first token (i.e., [CLS]) as the sentence embedding.
298
+
299
+ ```python
300
+ from transformers import AutoTokenizer, AutoModel
301
+ import torch
302
+ # Sentences we want sentence embeddings for
303
+ sentences = ["样例数据-1", "样例数据-2"]
304
+
305
+ # Load model from HuggingFace Hub
306
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-large-zh-v1.5')
307
+ model = AutoModel.from_pretrained('BAAI/bge-large-zh-v1.5')
308
+ model.eval()
309
+
310
+ # Tokenize sentences
311
+ encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
312
+ # for s2p(short query to long passage) retrieval task, add an instruction to query (not add instruction for passages)
313
+ # encoded_input = tokenizer([instruction + q for q in queries], padding=True, truncation=True, return_tensors='pt')
314
+
315
+ # Compute token embeddings
316
+ with torch.no_grad():
317
+ model_output = model(**encoded_input)
318
+ # Perform pooling. In this case, cls pooling.
319
+ sentence_embeddings = model_output[0][:, 0]
320
+ # normalize embeddings
321
+ sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
322
+ print("Sentence embeddings:", sentence_embeddings)
323
+ ```
324
+
325
+ ### Usage for Reranker
326
+
327
+ Different from embedding model, reranker uses question and document as input and directly output similarity instead of embedding.
328
+ You can get a relevance score by inputting query and passage to the reranker.
329
+ The reranker is optimized based cross-entropy loss, so the relevance score is not bounded to a specific range.
330
+
331
+
332
+ #### Using FlagEmbedding
333
+ ```
334
+ pip install -U FlagEmbedding
335
+ ```
336
+
337
+ Get relevance scores (higher scores indicate more relevance):
338
+ ```python
339
+ from FlagEmbedding import FlagReranker
340
+ reranker = FlagReranker('BAAI/bge-reranker-large', use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
341
+
342
+ score = reranker.compute_score(['query', 'passage'])
343
+ print(score)
344
+
345
+ scores = reranker.compute_score([['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']])
346
+ print(scores)
347
+ ```
348
+
349
+
350
+ #### Using Huggingface transformers
351
+
352
+ ```python
353
+ import torch
354
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
355
+
356
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-large')
357
+ model = AutoModelForSequenceClassification.from_pretrained('BAAI/bge-reranker-large')
358
+ model.eval()
359
+
360
+ pairs = [['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]
361
+ with torch.no_grad():
362
+ inputs = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt', max_length=512)
363
+ scores = model(**inputs, return_dict=True).logits.view(-1, ).float()
364
+ print(scores)
365
+ ```
366
+
367
+ #### Usage reranker with the ONNX files
368
+
369
+ ```python
370
+ from optimum.onnxruntime import ORTModelForSequenceClassification # type: ignore
371
+
372
+ import torch
373
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
374
+
375
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-reranker-large')
376
+ model = AutoModelForSequenceClassification.from_pretrained('BAAI/bge-reranker-base')
377
+ model_ort = ORTModelForSequenceClassification.from_pretrained('BAAI/bge-reranker-base', file_name="onnx/model.onnx")
378
+
379
+ # Sentences we want sentence embeddings for
380
+ pairs = [['what is panda?', 'hi'], ['what is panda?', 'The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear or simply panda, is a bear species endemic to China.']]
381
+
382
+ # Tokenize sentences
383
+ encoded_input = tokenizer(pairs, padding=True, truncation=True, return_tensors='pt')
384
+
385
+ scores_ort = model_ort(**encoded_input, return_dict=True).logits.view(-1, ).float()
386
+ # Compute token embeddings
387
+ with torch.inference_mode():
388
+ scores = model_ort(**encoded_input, return_dict=True).logits.view(-1, ).float()
389
+
390
+ # scores and scores_ort are identical
391
+ ```
392
+ #### Usage reranker with infinity
393
+
394
+ Its also possible to deploy the onnx/torch files with the [infinity_emb](https://github.com/michaelfeil/infinity) pip package.
395
+ ```python
396
+ import asyncio
397
+ from infinity_emb import AsyncEmbeddingEngine, EngineArgs
398
+
399
+ query='what is a panda?'
400
+ docs = ['The giant panda (Ailuropoda melanoleuca), sometimes called a panda bear', "Paris is in France."]
401
+
402
+ engine = AsyncEmbeddingEngine.from_args(
403
+ EngineArgs(model_name_or_path = "BAAI/bge-reranker-base", device="cpu", engine="torch" # or engine="optimum" for onnx
404
+ ))
405
+
406
+ async def main():
407
+ async with engine:
408
+ ranking, usage = await engine.rerank(query=query, docs=docs)
409
+ print(list(zip(ranking, docs)))
410
+ asyncio.run(main())
411
+ ```
412
+
413
+ ## Evaluation
414
+
415
+ `baai-general-embedding` models achieve **state-of-the-art performance on both MTEB and C-MTEB leaderboard!**
416
+ For more details and evaluation tools see our [scripts](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/README.md).
417
+
418
+ - **MTEB**:
419
+
420
+ | Model Name | Dimension | Sequence Length | Average (56) | Retrieval (15) |Clustering (11) | Pair Classification (3) | Reranking (4) | STS (10) | Summarization (1) | Classification (12) |
421
+ |:----:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
422
+ | [BAAI/bge-large-en-v1.5](https://huggingface.co/BAAI/bge-large-en-v1.5) | 1024 | 512 | **64.23** | **54.29** | 46.08 | 87.12 | 60.03 | 83.11 | 31.61 | 75.97 |
423
+ | [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) | 768 | 512 | 63.55 | 53.25 | 45.77 | 86.55 | 58.86 | 82.4 | 31.07 | 75.53 |
424
+ | [BAAI/bge-small-en-v1.5](https://huggingface.co/BAAI/bge-small-en-v1.5) | 384 | 512 | 62.17 |51.68 | 43.82 | 84.92 | 58.36 | 81.59 | 30.12 | 74.14 |
425
+ | [bge-large-en](https://huggingface.co/BAAI/bge-large-en) | 1024 | 512 | 63.98 | 53.9 | 46.98 | 85.8 | 59.48 | 81.56 | 32.06 | 76.21 |
426
+ | [bge-base-en](https://huggingface.co/BAAI/bge-base-en) | 768 | 512 | 63.36 | 53.0 | 46.32 | 85.86 | 58.7 | 81.84 | 29.27 | 75.27 |
427
+ | [gte-large](https://huggingface.co/thenlper/gte-large) | 1024 | 512 | 63.13 | 52.22 | 46.84 | 85.00 | 59.13 | 83.35 | 31.66 | 73.33 |
428
+ | [gte-base](https://huggingface.co/thenlper/gte-base) | 768 | 512 | 62.39 | 51.14 | 46.2 | 84.57 | 58.61 | 82.3 | 31.17 | 73.01 |
429
+ | [e5-large-v2](https://huggingface.co/intfloat/e5-large-v2) | 1024| 512 | 62.25 | 50.56 | 44.49 | 86.03 | 56.61 | 82.05 | 30.19 | 75.24 |
430
+ | [bge-small-en](https://huggingface.co/BAAI/bge-small-en) | 384 | 512 | 62.11 | 51.82 | 44.31 | 83.78 | 57.97 | 80.72 | 30.53 | 74.37 |
431
+ | [instructor-xl](https://huggingface.co/hkunlp/instructor-xl) | 768 | 512 | 61.79 | 49.26 | 44.74 | 86.62 | 57.29 | 83.06 | 32.32 | 61.79 |
432
+ | [e5-base-v2](https://huggingface.co/intfloat/e5-base-v2) | 768 | 512 | 61.5 | 50.29 | 43.80 | 85.73 | 55.91 | 81.05 | 30.28 | 73.84 |
433
+ | [gte-small](https://huggingface.co/thenlper/gte-small) | 384 | 512 | 61.36 | 49.46 | 44.89 | 83.54 | 57.7 | 82.07 | 30.42 | 72.31 |
434
+ | [text-embedding-ada-002](https://platform.openai.com/docs/guides/embeddings) | 1536 | 8192 | 60.99 | 49.25 | 45.9 | 84.89 | 56.32 | 80.97 | 30.8 | 70.93 |
435
+ | [e5-small-v2](https://huggingface.co/intfloat/e5-base-v2) | 384 | 512 | 59.93 | 49.04 | 39.92 | 84.67 | 54.32 | 80.39 | 31.16 | 72.94 |
436
+ | [sentence-t5-xxl](https://huggingface.co/sentence-transformers/sentence-t5-xxl) | 768 | 512 | 59.51 | 42.24 | 43.72 | 85.06 | 56.42 | 82.63 | 30.08 | 73.42 |
437
+ | [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2) | 768 | 514 | 57.78 | 43.81 | 43.69 | 83.04 | 59.36 | 80.28 | 27.49 | 65.07 |
438
+ | [sgpt-bloom-7b1-msmarco](https://huggingface.co/bigscience/sgpt-bloom-7b1-msmarco) | 4096 | 2048 | 57.59 | 48.22 | 38.93 | 81.9 | 55.65 | 77.74 | 33.6 | 66.19 |
439
+
440
+
441
+
442
+ - **C-MTEB**:
443
+ We create the benchmark C-MTEB for Chinese text embedding which consists of 31 datasets from 6 tasks.
444
+ Please refer to [C_MTEB](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/README.md) for a detailed introduction.
445
+
446
+ | Model | Embedding dimension | Avg | Retrieval | STS | PairClassification | Classification | Reranking | Clustering |
447
+ |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
448
+ | [**BAAI/bge-large-zh-v1.5**](https://huggingface.co/BAAI/bge-large-zh-v1.5) | 1024 | **64.53** | 70.46 | 56.25 | 81.6 | 69.13 | 65.84 | 48.99 |
449
+ | [BAAI/bge-base-zh-v1.5](https://huggingface.co/BAAI/bge-base-zh-v1.5) | 768 | 63.13 | 69.49 | 53.72 | 79.75 | 68.07 | 65.39 | 47.53 |
450
+ | [BAAI/bge-small-zh-v1.5](https://huggingface.co/BAAI/bge-small-zh-v1.5) | 512 | 57.82 | 61.77 | 49.11 | 70.41 | 63.96 | 60.92 | 44.18 |
451
+ | [BAAI/bge-large-zh](https://huggingface.co/BAAI/bge-large-zh) | 1024 | 64.20 | 71.53 | 54.98 | 78.94 | 68.32 | 65.11 | 48.39 |
452
+ | [bge-large-zh-noinstruct](https://huggingface.co/BAAI/bge-large-zh-noinstruct) | 1024 | 63.53 | 70.55 | 53 | 76.77 | 68.58 | 64.91 | 50.01 |
453
+ | [BAAI/bge-base-zh](https://huggingface.co/BAAI/bge-base-zh) | 768 | 62.96 | 69.53 | 54.12 | 77.5 | 67.07 | 64.91 | 47.63 |
454
+ | [multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) | 1024 | 58.79 | 63.66 | 48.44 | 69.89 | 67.34 | 56.00 | 48.23 |
455
+ | [BAAI/bge-small-zh](https://huggingface.co/BAAI/bge-small-zh) | 512 | 58.27 | 63.07 | 49.45 | 70.35 | 63.64 | 61.48 | 45.09 |
456
+ | [m3e-base](https://huggingface.co/moka-ai/m3e-base) | 768 | 57.10 | 56.91 | 50.47 | 63.99 | 67.52 | 59.34 | 47.68 |
457
+ | [m3e-large](https://huggingface.co/moka-ai/m3e-large) | 1024 | 57.05 | 54.75 | 50.42 | 64.3 | 68.2 | 59.66 | 48.88 |
458
+ | [multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) | 768 | 55.48 | 61.63 | 46.49 | 67.07 | 65.35 | 54.35 | 40.68 |
459
+ | [multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) | 384 | 55.38 | 59.95 | 45.27 | 66.45 | 65.85 | 53.86 | 45.26 |
460
+ | [text-embedding-ada-002(OpenAI)](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings) | 1536 | 53.02 | 52.0 | 43.35 | 69.56 | 64.31 | 54.28 | 45.68 |
461
+ | [luotuo](https://huggingface.co/silk-road/luotuo-bert-medium) | 1024 | 49.37 | 44.4 | 42.78 | 66.62 | 61 | 49.25 | 44.39 |
462
+ | [text2vec-base](https://huggingface.co/shibing624/text2vec-base-chinese) | 768 | 47.63 | 38.79 | 43.41 | 67.41 | 62.19 | 49.45 | 37.66 |
463
+ | [text2vec-large](https://huggingface.co/GanymedeNil/text2vec-large-chinese) | 1024 | 47.36 | 41.94 | 44.97 | 70.86 | 60.66 | 49.16 | 30.02 |
464
+
465
+
466
+ - **Reranking**:
467
+ See [C_MTEB](https://github.com/FlagOpen/FlagEmbedding/blob/master/C_MTEB/) for evaluation script.
468
+
469
+ | Model | T2Reranking | T2RerankingZh2En\* | T2RerankingEn2Zh\* | MMarcoReranking | CMedQAv1 | CMedQAv2 | Avg |
470
+ |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
471
+ | text2vec-base-multilingual | 64.66 | 62.94 | 62.51 | 14.37 | 48.46 | 48.6 | 50.26 |
472
+ | multilingual-e5-small | 65.62 | 60.94 | 56.41 | 29.91 | 67.26 | 66.54 | 57.78 |
473
+ | multilingual-e5-large | 64.55 | 61.61 | 54.28 | 28.6 | 67.42 | 67.92 | 57.4 |
474
+ | multilingual-e5-base | 64.21 | 62.13 | 54.68 | 29.5 | 66.23 | 66.98 | 57.29 |
475
+ | m3e-base | 66.03 | 62.74 | 56.07 | 17.51 | 77.05 | 76.76 | 59.36 |
476
+ | m3e-large | 66.13 | 62.72 | 56.1 | 16.46 | 77.76 | 78.27 | 59.57 |
477
+ | bge-base-zh-v1.5 | 66.49 | 63.25 | 57.02 | 29.74 | 80.47 | 84.88 | 63.64 |
478
+ | bge-large-zh-v1.5 | 65.74 | 63.39 | 57.03 | 28.74 | 83.45 | 85.44 | 63.97 |
479
+ | [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) | 67.28 | 63.95 | 60.45 | 35.46 | 81.26 | 84.1 | 65.42 |
480
+ | [BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large) | 67.6 | 64.03 | 61.44 | 37.16 | 82.15 | 84.18 | 66.09 |
481
+
482
+ \* : T2RerankingZh2En and T2RerankingEn2Zh are cross-language retrieval tasks
483
+
484
+ ## Train
485
+
486
+ ### BAAI Embedding
487
+
488
+ We pre-train the models using [retromae](https://github.com/staoxiao/RetroMAE) and train them on large-scale pairs data using contrastive learning.
489
+ **You can fine-tune the embedding model on your data following our [examples](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune).**
490
+ We also provide a [pre-train example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/pretrain).
491
+ Note that the goal of pre-training is to reconstruct the text, and the pre-trained model cannot be used for similarity calculation directly, it needs to be fine-tuned.
492
+ More training details for bge see [baai_general_embedding](https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/baai_general_embedding/README.md).
493
+
494
+
495
+
496
+ ### BGE Reranker
497
+
498
+ Cross-encoder will perform full-attention over the input pair,
499
+ which is more accurate than embedding model (i.e., bi-encoder) but more time-consuming than embedding model.
500
+ Therefore, it can be used to re-rank the top-k documents returned by embedding model.
501
+ We train the cross-encoder on a multilingual pair data,
502
+ The data format is the same as embedding model, so you can fine-tune it easily following our [example](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/reranker).
503
+ More details please refer to [./FlagEmbedding/reranker/README.md](https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/reranker)
504
+
505
+
506
+ ## Contact
507
+ If you have any question or suggestion related to this project, feel free to open an issue or pull request.
508
+ You also can email Shitao Xiao(stxiao@baai.ac.cn) and Zheng Liu(liuzheng@baai.ac.cn).
509
+
510
+
511
+ ## Citation
512
+
513
+ If you find this repository useful, please consider giving a star :star: and citation
514
+
515
+ ```
516
+ @misc{bge_embedding,
517
+ title={C-Pack: Packaged Resources To Advance General Chinese Embedding},
518
+ author={Shitao Xiao and Zheng Liu and Peitian Zhang and Niklas Muennighoff},
519
+ year={2023},
520
+ eprint={2309.07597},
521
+ archivePrefix={arXiv},
522
+ primaryClass={cs.CL}
523
+ }
524
+ ```
525
+
526
+ ## License
527
+ FlagEmbedding is licensed under the [MIT License](https://github.com/FlagOpen/FlagEmbedding/blob/master/LICENSE). The released models can be used for commercial purposes free of charge.
528
+
config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "xlm-roberta-large",
3
+ "architectures": [
4
+ "XLMRobertaForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": 0,
8
+ "classifier_dropout": null,
9
+ "eos_token_id": 2,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.1,
12
+ "hidden_size": 1024,
13
+ "id2label": {
14
+ "0": "LABEL_0"
15
+ },
16
+ "initializer_range": 0.02,
17
+ "intermediate_size": 4096,
18
+ "label2id": {
19
+ "LABEL_0": 0
20
+ },
21
+ "layer_norm_eps": 1e-05,
22
+ "max_position_embeddings": 514,
23
+ "model_type": "xlm-roberta",
24
+ "num_attention_heads": 16,
25
+ "num_hidden_layers": 24,
26
+ "output_past": true,
27
+ "pad_token_id": 1,
28
+ "position_embedding_type": "absolute",
29
+ "torch_dtype": "float32",
30
+ "transformers_version": "4.30.0",
31
+ "type_vocab_size": 1,
32
+ "use_cache": true,
33
+ "vocab_size": 250002
34
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5ae4e262c60ed2fb507ec587358285377ec36ee0a2e6da029f0534272b06d36
3
+ size 2239618772
onnx/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0528834a83cbe4b37fd20a887dd8f3dbdc6d924ffaaab51278d0a05364410117
3
+ size 618476
onnx/model.onnx_data ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e88670fb90657362754eee65d1e29ea14689dab61caca572051db8f6e5d9109c
3
+ size 2239565824
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62129e841464da714b961eb0bbbeb48c0f0b5f67e657902aaa3befcff6b3dab3
3
+ size 2239705845
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
3
+ size 5069051
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "cls_token": "<s>",
4
+ "eos_token": "</s>",
5
+ "mask_token": {
6
+ "content": "<mask>",
7
+ "lstrip": true,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "</s>",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9eb652ac4e40cc093272bbbe0f55d521cf67570060227109b5cdc20945a4489e
3
+ size 17098107
tokenizer_config.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "<s>",
3
+ "clean_up_tokenization_spaces": true,
4
+ "cls_token": "<s>",
5
+ "eos_token": "</s>",
6
+ "mask_token": {
7
+ "__type": "AddedToken",
8
+ "content": "<mask>",
9
+ "lstrip": true,
10
+ "normalized": true,
11
+ "rstrip": false,
12
+ "single_word": false
13
+ },
14
+ "model_max_length": 512,
15
+ "pad_token": "<pad>",
16
+ "sep_token": "</s>",
17
+ "sp_model_kwargs": {},
18
+ "tokenizer_class": "XLMRobertaTokenizer",
19
+ "unk_token": "<unk>"
20
+ }