Text Ranking
sentence-transformers
Safetensors
Transformers
multilingual
t5gemma2
text2text-generation
reranker
encoder-decoder
FBNL
Retrieval
RAG
cosyy commited on
Commit
4d3f673
·
verified ·
1 Parent(s): d541cf1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +59 -0
README.md CHANGED
@@ -92,6 +92,7 @@ On LMEB, reranking models demonstrate a clear advantage, with even the 0.27B Nan
92
  ![lmeb_emb](./assets/lmeb_emb.jpg)
93
 
94
  # Usage
 
95
  ```python
96
  import argparse
97
  from typing import Optional
@@ -204,6 +205,64 @@ rankings: [{'corpus_id': 0, 'score': 0.9998205304145813}, {'corpus_id': 1, 'scor
204
 
205
  ```
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  # Acknowledgements
208
  We sincerely thank `jina-reranker-v3` and `Qwen3-Reranker` for their valuable inspiration and contributions to the reranking community, from which we have learned a lot.
209
 
 
92
  ![lmeb_emb](./assets/lmeb_emb.jpg)
93
 
94
  # Usage
95
+ ## Using transformers
96
  ```python
97
  import argparse
98
  from typing import Optional
 
205
 
206
  ```
207
 
208
+ ## Using vLLM
209
+ An experimental single-GPU adapter is available for offline
210
+ `LLM.classify()` reranking and optional FastAPI serving. It reuses the original
211
+ checkpoint without adding or modifying model weights.
212
+
213
+ The adapter has been validated with Python 3.12, vLLM 0.19.1, Transformers
214
+ 5.6.2 and CUDA BF16:
215
+
216
+ ```bash
217
+ conda create -n kalm-vllm python=3.12 -y
218
+ conda activate kalm-vllm
219
+ pip install "vllm==0.19.1" "transformers==5.6.2"
220
+
221
+ hf download KaLM-Embedding/KaLM-Reranker-V1-Nano \
222
+ --local-dir ./KaLM-Reranker-V1-Nano
223
+ pip install ./KaLM-Reranker-V1-Nano/vllm_support --no-deps
224
+ export VLLM_PLUGINS=kalm_t5gemma2
225
+ ```
226
+
227
+ Offline Python:
228
+
229
+ ```python
230
+ from kalm_t5gemma2_vllm_plugin import KaLMVLLMReranker
231
+
232
+ query = "What is the capital of China?"
233
+ documents = [
234
+ "The capital of China is Beijing.",
235
+ "Gravity attracts bodies toward one another.",
236
+ ]
237
+
238
+ with KaLMVLLMReranker(
239
+ "KaLM-Embedding/KaLM-Reranker-V1-Nano",
240
+ query_max_length=512,
241
+ document_max_length=1024,
242
+ encoder_chunk_size=4,
243
+ ) as reranker:
244
+ print(reranker.rank(query, documents))
245
+ ```
246
+
247
+ Offline CLI and online service:
248
+
249
+ ```bash
250
+ kalm-vllm-rerank --return-margin
251
+
252
+ pip install "fastapi>=0.136,<0.137" "uvicorn>=0.46,<0.47"
253
+ kalm-vllm-serve --host 0.0.0.0 --port 8000
254
+ kalm-vllm-client --endpoint rerank --return-margin
255
+ ```
256
+
257
+ The default output is `P(yes)`. Set `return_margin=true` to also receive
258
+ `yes_logit - no_logit`. The supported encoder chunk sizes are
259
+ `1, 2, 4, 8, 16, 32`, with `4` as the default.
260
+
261
+ This adapter uses vLLM's plugin, scheduling and pooling interfaces while the
262
+ T5Gemma2 semantic forward still runs through Transformers. It is not vLLM's
263
+ native HTTP `/score` implementation or a complete vLLM-native kernel port.
264
+ See [the complete installation, API and troubleshooting guide](./vllm_support/README.md).
265
+
266
  # Acknowledgements
267
  We sincerely thank `jina-reranker-v3` and `Qwen3-Reranker` for their valuable inspiration and contributions to the reranking community, from which we have learned a lot.
268