Kaguya-19 commited on
Commit
6253eb2
·
verified ·
1 Parent(s): c1cf0cd

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -25
README.md CHANGED
@@ -9,20 +9,20 @@ language:
9
 
10
  ## MiniCPM3-RAG-LoRA
11
 
12
- **MiniCPM3-RAG-LoRA** 由面壁智能与清华大学自然语言处理实验室(THUNLP)共同开发,采用直接偏好优化(DPO)方法对 [MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B) 进行 LoRA 微调,仅基于两万余条开放域问答和逻辑推理任务的开源数据,在通用评测数据集上实现了模型性能平均提升 13%。
13
 
14
  欢迎关注 `MiniCPM3` 与 RAG 套件系列:
15
 
16
- - 生成模型:[MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B)
17
  - 检索模型:[RankCPM-E](https://huggingface.co/openbmb/RankCPM-E)
18
  - 重排模型:[RankCPM-R](https://huggingface.co/openbmb/RankCPM-R)
19
  - 面向 RAG 场景的 LoRA 插件:[MiniCPM3-RAG-LoRA](https://huggingface.co/openbmb/MiniCPM3-RAG-LoRA)
20
 
21
- **MiniCPM3-RAG-LoRA** developed by ModelBest Inc. and THUNLP, utilizes the Direct Preference Optimization (DPO) method to fine-tune [MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B) with LoRA. By training on just over 20,000 open-source data points from open-domain question answering and logical reasoning tasks, the model achieved an average performance improvement of 13% on general benchmark datasets.
22
 
23
- We also invite you to explore MiniCPM3 and the RAG toolkit series:
24
 
25
- - Generation Model: [MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B)
26
  - Retrieval Model: [RankCPM-E](https://huggingface.co/openbmb/RankCPM-E)
27
  - Re-ranking Model: [RankCPM-R](https://huggingface.co/openbmb/RankCPM-R)
28
  - LoRA Plugin for RAG scenarios: [MiniCPM3-RAG-LoRA](https://huggingface.co/openbmb/MiniCPM3-RAG-LoRA)
@@ -30,7 +30,9 @@ We also invite you to explore MiniCPM3 and the RAG toolkit series:
30
  ## 模型信息 Model Information
31
 
32
  - 模型大小:4B
 
33
  - Model Size: 4B
 
34
 
35
  ## 模型使用 Usage
36
 
@@ -41,21 +43,11 @@ MiniCPM3-RAG-LoRA 模型遵循格式如下:
41
  MiniCPM3-RAG-LoRA supports instructions in the following format:
42
 
43
  ```
44
- Background: {{ passages }} Query: {{ query }}
45
- ```
46
-
47
- 例如:
48
-
49
- For example:
50
 
51
- ```
52
- Background:
53
- ["In the novel 'The Silent Watcher,' the lead character is named Alex Carter. Alex is a private detective who uncovers a series of mysterious events in a small town.",
54
- "Set in a quiet town, 'The Silent Watcher' follows Alex Carter, a former police officer turned private investigator, as he unravels the town's dark secrets.",
55
- "'The Silent Watcher' revolves around Alex Carter's journey as he confronts his past while solving complex cases in his hometown."]
56
 
57
- Query:
58
- "What is the name of the lead character in the novel 'The Silent Watcher'?"
59
  ```
60
 
61
  ### 环境要求 Requirements
@@ -75,12 +67,13 @@ path = 'openbmb/MiniCPM3-RAG-LoRA'
75
  tokenizer = AutoTokenizer.from_pretrained(path)
76
  model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map='cuda', trust_remote_code=True)
77
 
78
- passages = ["In the novel 'The Silent Watcher,' the lead character is named Alex Carter. Alex is a private detective who uncovers a series of mysterious events in a small town.",
79
  "Set in a quiet town, 'The Silent Watcher' follows Alex Carter, a former police officer turned private investigator, as he unravels the town's dark secrets.",
80
  "'The Silent Watcher' revolves around Alex Carter's journey as he confronts his past while solving complex cases in his hometown."]
81
- query = "What is the name of the lead character in the novel 'The Silent Watcher'?"
82
 
83
- input_text = 'Background:\n' + str(passages) + '\n\n' + 'Query:\n' + str(query) + '\n\n'
 
84
 
85
  messages = [
86
  {"role": "system", "content": "You are a helpful assistant."},
@@ -109,12 +102,12 @@ After being fine-tuned with LoRA for RAG scenarios, MiniCPM3-RAG-LoRA outperform
109
  ## 许可证 License
110
 
111
  - 本仓库中代码依照 [Apache-2.0 协议](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE)开源。
112
- - RankCPM-R 模型权重的使用则需要遵循 [MiniCPM 模型协议](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md)。
113
- - RankCPM-R 模型权重对学术研究完全开放。如需将模型用于商业用途,请填写[此问卷](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g)。
114
 
115
  * The code in this repo is released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License.
116
- * The usage of RankCPM-R model weights must strictly follow [MiniCPM Model License.md](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md).
117
- * The models and weights of RankCPM-R are completely free for academic research. After filling out a ["questionnaire"](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g) for registration, RankCPM-R weights are also available for free commercial use.
118
  <!-- ### 测试集介绍:
119
 
120
  - **Natural Questions (NQ, Accuracy):**
 
9
 
10
  ## MiniCPM3-RAG-LoRA
11
 
12
+ **MiniCPM3-RAG-LoRA** 由面壁智能、东北大学信息检索小组(NEUIR)和清华大学自然语言处理实验室(THUNLP)和共同开发,是一个专门面向检索增强生成(RAG)场景的生成模型。它在 [MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B) 的基础上,采用低秩适应(LoRA)技术,通过直接偏好优化(DPO)方法进行微调,仅基于两万余条开放域问答和逻辑推理任务的开源数据,在通用评测数据集上实现了模型性能平均提升约 13%。
13
 
14
  欢迎关注 `MiniCPM3` 与 RAG 套件系列:
15
 
16
+ - 基座模型:[MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B)
17
  - 检索模型:[RankCPM-E](https://huggingface.co/openbmb/RankCPM-E)
18
  - 重排模型:[RankCPM-R](https://huggingface.co/openbmb/RankCPM-R)
19
  - 面向 RAG 场景的 LoRA 插件:[MiniCPM3-RAG-LoRA](https://huggingface.co/openbmb/MiniCPM3-RAG-LoRA)
20
 
21
+ **MiniCPM3-RAG-LoRA** developed by ModelBest Inc., NEUIR and THUNLP, is a generative model specifically designed for Retrieval-Augmented Generation (RAG) scenarios. Based on [MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B), the model is fine-tuned using the Low-Rank Adaptation (LoRA) technique through Direct Preference Optimization (DPO). The fine-tuning process is based on over 20,000 open-source data points from open-domain question answering and logical reasoning tasks, leading to an average performance improvement of approximately 13% on general evaluation datasets.
22
 
23
+ We also invite you to explore `MiniCPM3` and the RAG toolkit series:
24
 
25
+ - Foundation Model: [MiniCPM3](https://huggingface.co/openbmb/MiniCPM3-4B)
26
  - Retrieval Model: [RankCPM-E](https://huggingface.co/openbmb/RankCPM-E)
27
  - Re-ranking Model: [RankCPM-R](https://huggingface.co/openbmb/RankCPM-R)
28
  - LoRA Plugin for RAG scenarios: [MiniCPM3-RAG-LoRA](https://huggingface.co/openbmb/MiniCPM3-RAG-LoRA)
 
30
  ## 模型信息 Model Information
31
 
32
  - 模型大小:4B
33
+ - 最大输入token数:32768
34
  - Model Size: 4B
35
+ - Max Input Tokens: 32768
36
 
37
  ## 模型使用 Usage
38
 
 
43
  MiniCPM3-RAG-LoRA supports instructions in the following format:
44
 
45
  ```
46
+ Passages = "In the novel 'The Silent Watcher,' the lead character is named Alex Carter. Alex is a private detective who uncovers a series of mysterious events in a small town.\nSet in a quiet town, 'The Silent Watcher' follows Alex Carter, a former police officer turned private investigator, as he unravels the town's dark secrets.\n'The Silent Watcher' revolves around Alex Carter's journey as he confronts his past while solving complex cases in his hometown.",
 
 
 
 
 
47
 
48
+ Instruction = "Q: What is the name of the lead character in the novel 'The Silent Watcher'?\nA:"
 
 
 
 
49
 
50
+ Input = 'Background:\n'+ Passages + '\n\n' + Instruction
 
51
  ```
52
 
53
  ### 环境要求 Requirements
 
67
  tokenizer = AutoTokenizer.from_pretrained(path)
68
  model = AutoModelForCausalLM.from_pretrained(path, torch_dtype=torch.bfloat16, device_map='cuda', trust_remote_code=True)
69
 
70
+ passages_list = ["In the novel 'The Silent Watcher,' the lead character is named Alex Carter. Alex is a private detective who uncovers a series of mysterious events in a small town.",
71
  "Set in a quiet town, 'The Silent Watcher' follows Alex Carter, a former police officer turned private investigator, as he unravels the town's dark secrets.",
72
  "'The Silent Watcher' revolves around Alex Carter's journey as he confronts his past while solving complex cases in his hometown."]
73
+ instruction = "Q: What is the name of the lead character in the novel 'The Silent Watcher'?\nA:"
74
 
75
+ passages = '\n'.join(passages_list)
76
+ input_text = 'Background:\n' + passages + '\n\n' + instruction
77
 
78
  messages = [
79
  {"role": "system", "content": "You are a helpful assistant."},
 
102
  ## 许可证 License
103
 
104
  - 本仓库中代码依照 [Apache-2.0 协议](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE)开源。
105
+ - MiniCPM3-RAG-LoRA 模型权重的使用则需要遵循 [MiniCPM 模型协议](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md)。
106
+ - MiniCPM3-RAG-LoRA 模型权重对学术研究完全开放。如需将模型用于商业用途,请填写[此问卷](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g)。
107
 
108
  * The code in this repo is released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License.
109
+ * The usage of MiniCPM3-RAG-LoRA model weights must strictly follow [MiniCPM Model License.md](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md).
110
+ * The models and weights of MiniCPM3-RAG-LoRA are completely free for academic research. After filling out a ["questionnaire"](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g) for registration, MiniCPM3-RAG-LoRA weights are also available for free commercial use.
111
  <!-- ### 测试集介绍:
112
 
113
  - **Natural Questions (NQ, Accuracy):**