Run this model with HF Jobs
Run openbmb/MiniCPM-Reranker on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/openbmb/MiniCPM-Reranker. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/openbmb/MiniCPM-Reranker on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use openbmb/MiniCPM-Reranker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openbmb/MiniCPM-Reranker with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="openbmb/MiniCPM-Reranker", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("openbmb/MiniCPM-Reranker", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files12345612378910111271314151611121718192015212223242520262728292425303132333410 unmodified lines454647424849505113 unmodified lines656667626869707117 unmodified lines899091869293949556 unmodified lines1521531541491551561571587 unmodified lines166167168163169170171172173168169174175176177172173178179---language:- zh- enbase_model: openbmb/MiniCPM-2B-dpo-bf16---## MiniCPM-RR
**MiniCPM-RR** 是面壁智能与清华大学自然语言处理实验室(THUNLP)共同开发的中英双语言文本重排序模型,有如下特点:## RankCPM-R
**RankCPM-R** 是面壁智能与清华大学自然语言处理实验室(THUNLP)共同开发的中英双语言文本重排序模型,有如下特点:- 出色的中文、英文重排序能力。- 出色的中英跨语言重排序能力。
MiniCPM-RR 基于 [MiniCPM-2B-sft-bf16](https://huggingface.co/openbmb/MiniCPM-2B-sft-bf16) 训练,结构上采取双向注意力。采取多阶段训练方式,共使用包括开源数据、机造数据、闭源数据在内的约 600 万条训练数据。RankCPM-R 基于 [MiniCPM-2B-sft-bf16](https://huggingface.co/openbmb/MiniCPM-2B-sft-bf16) 训练,结构上采取双向注意力。采取多阶段训练方式,共使用包括开源数据、机造数据、闭源数据在内的约 600 万条训练数据。
欢迎关注 RAG 套件系列:
- 检索模型:[MiniCPM-R](https://huggingface.co/openbmb/MiniCPM-R)- 重排模型:[MiniCPM-RR](https://huggingface.co/openbmb/MiniCPM-RR)- 检索模型:[RankCPM-E](https://huggingface.co/openbmb/RankCPM-E)- 重排模型:[RankCPM-R](https://huggingface.co/openbmb/RankCPM-R)- 面向 RAG 场景的 LoRA 插件:[MiniCPM3-RAG-LoRA](https://huggingface.co/openbmb/MiniCPM3-RAG-LoRA)
**MiniCPM-RR** is a bilingual & cross-lingual text re-ranking model developed by ModelBest Inc. and THUNLP, featuring:**RankCPM-R** is a bilingual & cross-lingual text re-ranking model developed by ModelBest Inc. and THUNLP, featuring:
- Exceptional Chinese and English re-ranking capabilities.- Outstanding cross-lingual re-ranking capabilities between Chinese and English.
MiniCPM-RR is trained based on [MiniCPM-2B-sft-bf16](https://huggingface.co/openbmb/MiniCPM-2B-sft-bf16) and incorporates bidirectional attention in its architecture. The model underwent multi-stage training using approximately 6 million training examples, including open-source, synthetic, and proprietary data.RankCPM-R is trained based on [MiniCPM-2B-sft-bf16](https://huggingface.co/openbmb/MiniCPM-2B-sft-bf16) and incorporates bidirectional attention in its architecture. The model underwent multi-stage training using approximately 6 million training examples, including open-source, synthetic, and proprietary data.
We also invite you to explore the RAG toolkit series:
- Retrieval Model: [MiniCPM-R](https://huggingface.co/openbmb/MiniCPM-R)- Re-ranking Model: [MiniCPM-RR](https://huggingface.co/openbmb/MiniCPM-RR)- Retrieval Model: [RankCPM-E](https://huggingface.co/openbmb/RankCPM-E)- Re-ranking Model: [RankCPM-R](https://huggingface.co/openbmb/RankCPM-R)- LoRA Plugin for RAG scenarios: [MiniCPM3-RAG-LoRA](https://huggingface.co/openbmb/MiniCPM3-RAG-LoRA)
## 模型信息 Model Information10 unmodified lines
本模型支持指令,输入格式如下:
MiniCPM-RR supports instructions in the following format:RankCPM-R supports instructions in the following format:
```<s>Instruction: {{ instruction }} Query: {{ query }}</s>{{ document }}13 unmodified lines
也可以不提供指令,即采取如下格式:
MiniCPM-RR also works in instruction-free mode in the following format:RankCPM-R also works in instruction-free mode in the following format:
```<s>Query: {{ query }}</s>{{ document }}17 unmodified linesimport torchimport numpy as np
model_name = "openbmb/MiniCPM-RR"model_name = "openbmb/RankCPM-R"tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)tokenizer.padding_side = "right"model = AutoModelForSequenceClassification.from_pretrained(model_name, trust_remote_code=True,attn_implementation="flash_attention_2", torch_dtype=torch.float16).to("cuda")56 unmodified lines| bge-reranker-v2-minicpm-28 | 73.51 | 59.86 || bge-reranker-v2-gemma | 71.74 | 60.71 || bge-reranker-v2.5-gemma2 | - | **63.67** || MiniCPM-RR | **76.79** | 61.32 || RankCPM-R | **76.79** | 61.32 |
### 中英跨语言重排序结果 CN-EN Cross-lingual Re-ranking Results
7 unmodified lines| jina-reranker-v2-base-multilingual | 69.33 | 36.66 | 50.03 || bge-reranker-v2-m3 | 69.75 | 40.98 | 49.67 || gte-multilingual-reranker-base | 68.51 | 38.74 | 45.3 || MiniCPM-RR | **71.73** | **43.65** | **50.59** || RankCPM-R | **71.73** | **43.65** | **50.59** |
## 许可证 License
- 本仓库中代码依照 [Apache-2.0 协议](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE)开源。- MiniCPM-RR 模型权重的使用则需要遵循 [MiniCPM 模型协议](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md)。- MiniCPM-RR 模型权重对学术研究完全开放。如需将模型用于商业用途,请填写[此问卷](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g)。- RankCPM-R 模型权重的使用则需要遵循 [MiniCPM 模型协议](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md)。- RankCPM-R 模型权重对学术研究完全开放。如需将模型用于商业用途,请填写[此问卷](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g)。
* The code in this repo is released under the [Apache-2.0](https://github.com/OpenBMB/MiniCPM/blob/main/LICENSE) License. * The usage of MiniCPM-RR model weights must strictly follow [MiniCPM Model License.md](https://github.com/OpenBMB/MiniCPM/blob/main/MiniCPM%20Model%20License.md).* The models and weights of MiniCPM-RR are completely free for academic research. After filling out a ["questionnaire"](https://modelbest.feishu.cn/share/base/form/shrcnpV5ZT9EJ6xYjh3Kx0J6v8g) for registration, MiniCPM-RR weights are also available for free commercial use.* 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).* 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.README.md+25-19