Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
|
3 |
+
# Doc / guide: https://huggingface.co/docs/hub/model-cards
|
4 |
+
{}
|
5 |
+
---
|
6 |
+
|
7 |
+
# Model name
|
8 |
+
|
9 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
10 |
+
Tc_Embedding 是专为增强中文文本检索能力而设计的嵌入模型。它基于bge-m3-retromae[1],实现了预训练、微调、精调全流程。该模型在来自各个领域的大量语料库上进行训练,语料库的批量非常大。截至 2024 年 8 月 27 日,Tc_Embedding 在检索任务中表现出色,在 C-MTEB 排行榜上排名第一,领先的性能得分为 78.23。
|
11 |
+
|
12 |
+
## Training Details
|
13 |
+
基于bge-m3-retromae[1],主要改动如下:
|
14 |
+
<!-- Provide a longer summary of what this model is. -->
|
15 |
+
- 基于bge-m3-retromae[1]在亿级数据上实现了预训练。
|
16 |
+
- 在收集的公开亿级检索数据集上实现了微调。
|
17 |
+
- 在收集的公开百万级检索数据集和百万级LLM合成数据集上实现了精调。
|
18 |
+
- 通过 LLM (QWEN-72B) 进行数据生成,使用 LLM 为message生成新query
|
19 |
+
- 数据清洗:
|
20 |
+
- 简单的基于规则清洗
|
21 |
+
- LLM判断是否可作为搜索引擎查询的query
|
22 |
+
- rerank模型对(query,message)评分,舍弃pos中的负例,neg中的正例
|
23 |
+
|
24 |
+
## Collect more data for retrieval-type tasks
|
25 |
+
1. MTP
|
26 |
+
2. BGE-LARGE-zh data
|
27 |
+
3. PEG data
|
28 |
+
4. BGE-M3 data
|
29 |
+
5. miracl/miracl
|
30 |
+
6. FreedomIntelligence/Huatuo26M-Lite
|
31 |
+
|
32 |
+
## Generate Embedding for text
|
33 |
+
```python
|
34 |
+
from FlagEmbedding import BGEM3FlagModel
|
35 |
+
|
36 |
+
model = BGEM3FlagModel('chuxin/tc_embedding',
|
37 |
+
use_fp16=True) # Setting use_fp16 to True speeds up computation with a slight performance degradation
|
38 |
+
|
39 |
+
sentences_1 = ["样例数据-1", "样例数据-2"]
|
40 |
+
sentences_2 = ["样例数据-3", "样例数据-1"]
|
41 |
+
|
42 |
+
embeddings_1 = model.encode(sentences_1,
|
43 |
+
batch_size=12,
|
44 |
+
max_length=1024,
|
45 |
+
)['dense_vecs']
|
46 |
+
embeddings_2 = model.encode(sentences_2)['dense_vecs']
|
47 |
+
similarity = embeddings_1 @ embeddings_2.T
|
48 |
+
print(similarity)
|
49 |
+
|
50 |
+
```
|
51 |
+
|
52 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
53 |
+
|
54 |
+
### Reference
|
55 |
+
1. https://huggingface.co/BAAI/bge-m3-retromae
|
56 |
+
2. https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/BGE_M3
|
57 |
+
3. https://github.com/FlagOpen/FlagEmbedding/tree/master/FlagEmbedding/baai_general_embedding
|
58 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|