BAAI
/

Shitao commited on
Commit
cfa9e40
1 Parent(s): c33c897

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +192 -51
README.md CHANGED
@@ -1,72 +1,125 @@
1
- # baai-general-embedding-large-zh-instruction
 
 
 
 
 
 
2
 
3
 
4
- Map any text to a low-dimensional dense vector which can be used for tasks like retrieval, classification, clustering, or semantic search.
5
- It also can be used in vector databases for LLMs.
6
- For more details please refer to our GitHub: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
 
9
  ## Model List
 
 
 
10
  | Model | Language | Description | query instruction for retrieval |
11
  |:-------------------------------|:--------:| :--------:| :--------:|
12
- | [BAAI/baai-general-embedding-large-en-instruction](https://huggingface.co/BAAI/baai-general-embedding-large-en-instruction) | English | rank **1st** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
13
- | [BAAI/baai-general-embedding-large-zh-instruction](https://huggingface.co/BAAI/baai-general-embedding-large-zh-instruction) | Chinese | rank **1st** in [C-MTEB]() bechmark | `为这个句子生成表示以用于检索相关文章:` |
14
- | [BAAI/baai-general-embedding-large-zh](https://huggingface.co/BAAI/baai-general-embedding-large-zh) | Chinese | rank **2nd** in [C-MTEB]() bechmark | -- |
 
 
 
 
15
 
16
 
17
- ## Evaluation Results
18
 
19
- - **C-MTEB**:
20
- We create a benchmark C-MTEB for Chinese text embedding which consists of 31 datasets from 6 tasks.
21
- More details and evaluation scripts see [evaluation](evaluation/README.md).
22
-
23
- | Model | Embedding dimension | Avg | Retrieval | STS | PairClassification | Classification | Reranking | Clustering |
24
- |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
25
- | [**baai-general-embedding-large-zh-instruction**](https://huggingface.co/BAAI/baai-general-embedding-large-zh-instruction) | 1024 | **63.84** | **71.53** | **53.23** | **78.94** | 72.26 | 62.33 | 48.39 |
26
- | [baai-general-embedding-large-zh](https://huggingface.co/BAAI/baai-general-embedding-large-zh) | 1024 | 63.62 | 70.55 | 50.98 | 76.77 | **72.49** | **65.63** | **50.01** |
27
- | [m3e-base](https://huggingface.co/moka-ai/m3e-base) | 768 | 57.10 |56.91 | 48.15 | 63.99 | 70.28 | 59.34 | 47.68 |
28
- | [m3e-large](https://huggingface.co/moka-ai/m3e-large) | 1024 | 57.05 |54.75 | 48.64 | 64.3 | 71.22 | 59.66 | 48.88 |
29
- | [text-embedding-ada-002(OpenAI)](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings) | 1536 | 53.02 | 52.0 | 40.61 | 69.56 | 67.38 | 54.28 | 45.68 |
30
- | [luotuo](https://huggingface.co/silk-road/luotuo-bert-medium) | 1024 | 49.37 | 44.4 | 39.41 | 66.62 | 65.29 | 49.25 | 44.39 |
31
- | [text2vec](https://huggingface.co/shibing624/text2vec-base-chinese) | 768 | 47.63 | 38.79 | 41.71 | 67.41 | 65.18 | 49.45 | 37.66 |
32
- | [text2vec-large](https://huggingface.co/GanymedeNil/text2vec-large-chinese) | 1024 | 47.36 | 41.94 | 41.98 | 70.86 | 63.42 | 49.16 | 30.02 |
33
-
34
 
 
 
 
 
 
 
 
 
 
 
 
35
 
36
- ## Usage
37
 
38
- ### Sentence-Transformers
39
 
40
- Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
41
 
42
  ```
43
  pip install -U sentence-transformers
44
  ```
45
-
46
- Then you can use the model like this:
47
-
48
  ```python
49
  from sentence_transformers import SentenceTransformer
50
  sentences = ["样例数据-1", "样例数据-2"]
51
- model = SentenceTransformer('BAAI/baai-general-embedding-large-zh-instruction')
52
  embeddings = model.encode(sentences, normalize_embeddings=True)
53
  print(embeddings)
54
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
 
56
 
57
- ### HuggingFace Transformers
58
- Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
59
 
60
  ```python
61
  from transformers import AutoTokenizer, AutoModel
62
  import torch
63
  # Sentences we want sentence embeddings for
64
  sentences = ["样例数据-1", "样例数据-2"]
 
65
  # Load model from HuggingFace Hub
66
- tokenizer = AutoTokenizer.from_pretrained('BAAI/baai-general-embedding-large-zh-instruction')
67
- model = AutoModel.from_pretrained('BAAI/baai-general-embedding-large-zh-instruction')
 
68
  # Tokenize sentences
69
  encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
 
 
 
70
  # Compute token embeddings
71
  with torch.no_grad():
72
  model_output = model(**encoded_input)
@@ -74,25 +127,113 @@ with torch.no_grad():
74
  sentence_embeddings = model_output[0][:, 0]
75
  # normalize embeddings
76
  sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
77
- print("Sentence embeddings:")
78
- print(sentence_embeddings)
79
  ```
80
 
81
 
82
- ### Retrieval Task
83
- For retrieval task, when you use the model whose name ends with `-instruction`
84
- each query should start with a instruction.
85
- ```python
86
- from sentence_transformers import SentenceTransformer
87
- queries = ["手机开不了机怎么办?"]
88
- passages = ["样例段落-1", "样例段落-2"]
89
- instruction = "为这个句子生成表示以用于检索相关文章:"
90
- model = SentenceTransformer('BAAI/baai-general-embedding-large-zh-instruction')
91
- q_embeddings = model.encode([instruction+q for q in queries], normalize_embeddings=True)
92
- p_embeddings = model.encode(passages, normalize_embeddings=True)
93
- scores = q_embeddings @ p_embeddings.T
94
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
- ## Limitations
97
- This model only works for Chinese texts and long texts will be truncated to a maximum of 512 tokens.
98
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - zh
5
+ pipeline_tag: sentence-similarity
6
+ ---
7
+ <h1 align="center">FlagEmbedding</h1>
8
 
9
 
10
+ <h4 align="center">
11
+ <p>
12
+ <a href=#model-list>Model List</a> |
13
+ <a href=#usage>Usage</a> |
14
+ <a href="#evaluation">Evaluation</a> |
15
+ <a href="#train">Train</a> |
16
+ <a href="#contact">Contact</a> |
17
+ <a href="#license">License</a>
18
+ <p>
19
+ </h4>
20
+
21
+ More details please refer to our github: [FlagEmbedding](https://github.com/FlagOpen/FlagEmbedding).
22
+
23
+ [English](README.md) | [中文](README_zh.md)
24
+
25
+ FlagEmbedding can map any text to a low-dimensional dense vector which can be used for tasks like retrieval, classification, clustering, or semantic search.
26
+ And it also can be used in vector database for LLMs.
27
+
28
+ ************* 🌟**Updates**🌟 *************
29
+ - 08/05/2023: Release base-scale and small-scale models, **best performance among the models of the same size 🤗**
30
+ - 08/02/2023: Release `bge-large-*`(short for BAAI General Embedding) Models, **rank 1st on MTEB and C-MTEB benchmark!**
31
+ - 08/01/2023: We release the Chinese Massive Text Embedding Benchmark (**C-MTEB**), consisting of 31 test dataset.
32
 
33
 
34
  ## Model List
35
+
36
+ `bge` is short for `BAAI general embedding`.
37
+
38
  | Model | Language | Description | query instruction for retrieval |
39
  |:-------------------------------|:--------:| :--------:| :--------:|
40
+ | [BAAI/bge-large-en](https://huggingface.co/BAAI/bge-large-en) | English | **rank 1st** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
41
+ | [BAAI/bge-base-en](https://huggingface.co/BAAI/bge-base-en) | English | **rank 2nd** in [MTEB](https://huggingface.co/spaces/mteb/leaderboard) leaderboard | `Represent this sentence for searching relevant passages: ` |
42
+ | [BAAI/bge-small-en](https://huggingface.co/BAAI/bge-small-en) | English | a small-scale model but with competitive performance | `Represent this sentence for searching relevant passages: ` |
43
+ | [BAAI/bge-large-zh](https://huggingface.co/BAAI/bge-large-zh) | Chinese | **rank 1st** in [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/benchmark) benchmark | `为这个句子生成表示以用于检索相关文章:` |
44
+ | [BAAI/bge-large-zh-noinstruct](https://huggingface.co/BAAI/bge-large-zh-noinstruct) | Chinese | This model is trained without instruction, and **rank 2nd** in [C-MTEB](https://github.com/FlagOpen/FlagEmbedding/tree/master/benchmark) benchmark | |
45
+ | [BAAI/bge-base-zh](https://huggingface.co/BAAI/bge-base-zh) | Chinese | a base-scale model but with competitive performance | `为这个句子生成表示以用于检索相关文章:` |
46
+ | [BAAI/bge-small-zh](https://huggingface.co/BAAI/bge-small-zh) | Chinese | a small-scale model but with competitive performance | `为这个句子生成表示以用于检索相关文章:` |
47
 
48
 
 
49
 
50
+ ## Usage
51
+
52
+ * **Using FlagEmbedding**
53
+ ```
54
+ pip install flag_embedding
55
+ ```
56
+ ```python
57
+ from flag_embedding import FlagModel
58
+ sentences = ["样例数据-1", "样例数据-2"]
59
+ model = FlagModel('BAAI/bge-large-zh', query_instruction_for_retrieval="为这个句子生成表示以用于检索相关文章:")
60
+ embeddings = model.encode(sentences)
61
+ print(embeddings)
 
 
 
62
 
63
+ # for retrieval task, please use encode_queries() which will automatically add the instruction to each query
64
+ # corpus in retrieval task can still use encode() or encode_corpus()
65
+ queries = ['query_1', 'query_2']
66
+ passages = ["样例段落-1", "样例段落-2"]
67
+ q_embeddings = model.encode_queries(queries)
68
+ p_embeddings = model.encode(passages)
69
+ scores = q_embeddings @ p_embeddings.T
70
+ ```
71
+ The value of argument `query_instruction_for_retrieval` see [Model List](https://github.com/FlagOpen/FlagEmbedding/tree/master#model-list).
72
+
73
+ FlagModel will use all available GPUs when encoding, please set `os.environ["CUDA_VISIBLE_DEVICES"]` to choose GPU.
74
 
 
75
 
76
+ * **Using Sentence-Transformers**
77
 
78
+ Using this model also is easy when you have [sentence-transformers](https://www.SBERT.net) installed:
79
 
80
  ```
81
  pip install -U sentence-transformers
82
  ```
 
 
 
83
  ```python
84
  from sentence_transformers import SentenceTransformer
85
  sentences = ["样例数据-1", "样例数据-2"]
86
+ model = SentenceTransformer('BAAI/bge-large-zh')
87
  embeddings = model.encode(sentences, normalize_embeddings=True)
88
  print(embeddings)
89
  ```
90
+ For retrieval task,
91
+ each query should start with a instruction (instructions see [Model List](https://github.com/FlagOpen/FlagEmbedding/tree/master#model-list)).
92
+ ```python
93
+ from sentence_transformers import SentenceTransformer
94
+ queries = ["手机开不了机怎么办?"]
95
+ passages = ["样例段落-1", "样例段落-2"]
96
+ instruction = "为这个句子生成表示以用于检索相关文章:"
97
+
98
+ model = SentenceTransformer('BAAI/bge-large-zh')
99
+ q_embeddings = model.encode([instruction+q for q in queries], normalize_embeddings=True)
100
+ p_embeddings = model.encode(passages, normalize_embeddings=True)
101
+ scores = q_embeddings @ p_embeddings.T
102
+ ```
103
 
104
+ * **Using HuggingFace Transformers**
105
 
106
+ With 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 first token (i.e., [CLS]) as the sentence embedding.
 
107
 
108
  ```python
109
  from transformers import AutoTokenizer, AutoModel
110
  import torch
111
  # Sentences we want sentence embeddings for
112
  sentences = ["样例数据-1", "样例数据-2"]
113
+
114
  # Load model from HuggingFace Hub
115
+ tokenizer = AutoTokenizer.from_pretrained('BAAI/bge-large-zh')
116
+ model = AutoModel.from_pretrained('BAAI/bge-large-zh')
117
+
118
  # Tokenize sentences
119
  encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
120
+ # for retrieval task, add a instruction to query
121
+ # encoded_input = tokenizer([instruction + q for q in queries], padding=True, truncation=True, return_tensors='pt')
122
+
123
  # Compute token embeddings
124
  with torch.no_grad():
125
  model_output = model(**encoded_input)
 
127
  sentence_embeddings = model_output[0][:, 0]
128
  # normalize embeddings
129
  sentence_embeddings = torch.nn.functional.normalize(sentence_embeddings, p=2, dim=1)
130
+ print("Sentence embeddings:", sentence_embeddings)
 
131
  ```
132
 
133
 
134
+ ## Evaluation
135
+ `baai-general-embedding` models achieve **state-of-the-art performance on both MTEB and C-MTEB leaderboard!**
136
+ More details and evaluation scripts see [benchemark](benchmark/README.md).
137
+
138
+ - **MTEB**:
139
+
140
+ | Model Name | Dimension | Sequence Length | Average (56) | Retrieval (15) |Clustering (11) | Pair Classification (3) | Reranking (4) | STS (10) | Summarization (1) | Classification (12) |
141
+ |:----:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
142
+ | [**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** |
143
+ | [**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 |
144
+ | [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 |
145
+ | [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 |
146
+ | [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 |
147
+ | [**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 |
148
+ | [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 |
149
+ | [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 |
150
+ | [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 |
151
+ | [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 |
152
+ | [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 |
153
+ | [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 |
154
+ | [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 |
155
+ | [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 |
156
+ | [all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2) | 384 | 512 | 56.53 | 42.69 | 41.81 | 82.41 | 58.44 | 79.8 | 27.9 | 63.21 |
157
+ | [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) | 384 | 512 | 56.26 | 41.95 | 42.35 | 82.37 | 58.04 | 78.9 | 30.81 | 63.05 |
158
+ | [contriever-base-msmarco](https://huggingface.co/nthakur/contriever-base-msmarco) | 768 | 512 | 56.00 | 41.88 | 41.1 | 82.54 | 53.14 | 76.51 | 30.36 | 66.68 |
159
+ | [sentence-t5-base](https://huggingface.co/sentence-transformers/sentence-t5-base) | 768 | 512 | 55.27 | 33.63 | 40.21 | 85.18 | 53.09 | 81.14 | 31.39 | 69.81 |
160
+
161
+
162
+
163
+ - **C-MTEB**:
164
+ We create a benchmark C-MTEB for Chinese text embedding which consists of 31 datasets from 6 tasks.
165
+ Please refer to [benchemark](benchmark/README.md) for a detailed introduction.
166
+
167
+ | Model | Embedding dimension | Avg | Retrieval | STS | PairClassification | Classification | Reranking | Clustering |
168
+ |:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
169
+ | [**bge-large-zh**](https://huggingface.co/BAAI/bge-large-zh) | 1024 | **64.20** | **71.53** | **53.23** | **78.94** | 72.26 | **65.11** | 48.39 |
170
+ | [**bge-large-zh-noinstruct**](https://huggingface.co/BAAI/bge-large-zh-noinstruct) | 1024 | 63.53 | 70.55 | 50.98 | 76.77 | **72.49** | 64.91 | **50.01** |
171
+ | [**BAAI/bge-base-zh**](https://huggingface.co/BAAI/bge-base-zh) | 768 | 62.96 | 69.53 | 52.05 | 77.5 | 70.98 | 64.91 | 47.63 |
172
+ | [**BAAI/bge-small-zh**](https://huggingface.co/BAAI/bge-small-zh) | 512 | 58.27 | 63.07 | 46.87 | 70.35 | 67.78 | 61.48 | 45.09 |
173
+ | [m3e-base](https://huggingface.co/moka-ai/m3e-base) | 768 | 57.10 |56.91 | 48.15 | 63.99 | 70.28 | 59.34 | 47.68 |
174
+ | [m3e-large](https://huggingface.co/moka-ai/m3e-large) | 1024 | 57.05 |54.75 | 48.64 | 64.3 | 71.22 | 59.66 | 48.88 |
175
+ | [text-embedding-ada-002(OpenAI)](https://platform.openai.com/docs/guides/embeddings/what-are-embeddings) | 1536 | 53.02 | 52.0 | 40.61 | 69.56 | 67.38 | 54.28 | 45.68 |
176
+ | [luotuo](https://huggingface.co/silk-road/luotuo-bert-medium) | 1024 | 49.37 | 44.4 | 39.41 | 66.62 | 65.29 | 49.25 | 44.39 |
177
+ | [text2vec](https://huggingface.co/shibing624/text2vec-base-chinese) | 768 | 47.63 | 38.79 | 41.71 | 67.41 | 65.18 | 49.45 | 37.66 |
178
+ | [text2vec-large](https://huggingface.co/GanymedeNil/text2vec-large-chinese) | 1024 | 47.36 | 41.94 | 41.98 | 70.86 | 63.42 | 49.16 | 30.02 |
179
+
180
+
181
+
182
+
183
+ ## Train
184
+ This section will introduce the way we used to train the general embedding.
185
+ The training scripts are in [flag_embedding](https://github.com/FlagOpen/FlagEmbedding/tree/master/flag_embedding/baai_general_embedding/),
186
+ and we provide some examples to do [pre-train](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/pretrain/) and [fine-tune](https://github.com/FlagOpen/FlagEmbedding/tree/master/examples/finetune).
187
+
188
+
189
+ **1. RetroMAE Pre-train**
190
+ We pre-train the model following the method [retromae](https://github.com/staoxiao/RetroMAE),
191
+ which shows promising improvement in retrieval task ([paper](https://aclanthology.org/2022.emnlp-main.35.pdf)).
192
+ The pre-training was conducted on 24 A100(40G) GPUs with a batch size of 720.
193
+ In retromae, the mask ratio of the encoder and decoder are 0.3, and 0.5 respectively.
194
+ We used the AdamW optimizer and the learning rate is 2e-5.
195
+
196
+ **Pre-training data**:
197
+ - English:
198
+ - [Pile](https://pile.eleuther.ai/)
199
+ - [wikipedia](https://huggingface.co/datasets/wikipedia)
200
+ - [msmarco](https://huggingface.co/datasets/Tevatron/msmarco-passage-corpus)
201
+ - Chinese:
202
+ - Subset of [wudao](https://github.com/BAAI-WuDao/Data)
203
+ - [baidu-baike](https://baike.baidu.com/)
204
+
205
+
206
+ **2. Finetune**
207
+ We fine-tune the model using a contrastive objective.
208
+ The format of input data is a triple`(query, positive, negative)`.
209
+ Besides the negative in the triple, we also adopt in-batch negatives strategy.
210
+ We employ the cross-device negatives sharing method to share negatives among different GPUs,
211
+ which can dramatically **increase the number of negatives**.
212
+
213
+ We trained our model on 48 A100(40G) GPUs with a large batch size of 32,768 (so there are **65,535** negatives for each query in a batch).
214
+ We used the AdamW optimizer and the learning rate is 1e-5.
215
+ The temperature for contrastive loss is 0.01.
216
+
217
+ For the version with `*-instrcution`, we add instruction to the query for the retrieval task in the training.
218
+ For English, the instruction is `Represent this sentence for searching relevant passages: `;
219
+ For Chinese, the instruction is `为这个句子生成表示以用于检索相关文章:`.
220
+ In the evaluation, the instruction should be added for sentence to passages retrieval task, not be added for other tasks.
221
+
222
+
223
+ The finetune script is accessible in this repository: [flag_embedding](https://github.com/FlagOpen/FlagEmbedding/tree/master/flag_embedding/baai_general_embedding/README.md).
224
+ You can easily finetune your model with it.
225
+
226
+ **Training data**:
227
+
228
+ - For English, we collect 230M text pairs from [wikipedia](https://huggingface.co/datasets/wikipedia), [cc-net](https://github.com/facebookresearch/cc_net), and so on.
229
+
230
+ - For Chinese, we collect 120M text pairs from [wudao](https://github.com/BAAI-WuDao/Data), [simclue](https://github.com/CLUEbenchmark/SimCLUE) and so on.
231
+
232
+ **The data collection is to be released in the future.**
233
+
234
+ We will continually update the embedding models and training codes,
235
+ hoping to promote the development of the embedding model community.
236
 
 
 
237
 
238
+ ## License
239
+ FlagEmbedding is licensed under [MIT License](). The released models can be used for commercial purposes free of charge.