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

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -4
README.md CHANGED
@@ -244,18 +244,63 @@ with KaLMVLLMReranker(
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
 
244
  print(reranker.rank(query, documents))
245
  ```
246
 
247
+ Offline CLI:
248
 
249
  ```bash
250
  kalm-vllm-rerank --return-margin
251
+ ```
252
+
253
+ To deploy the online service, install the HTTP dependencies and keep the
254
+ server running in the first terminal:
255
 
256
+ ```bash
257
  pip install "fastapi>=0.136,<0.137" "uvicorn>=0.46,<0.47"
258
+ export CUDA_VISIBLE_DEVICES=0
259
+ export VLLM_PLUGINS=kalm_t5gemma2
260
+
261
+ kalm-vllm-serve \
262
+ --host 0.0.0.0 \
263
+ --port 8000 \
264
+ --model KaLM-Embedding/KaLM-Reranker-V1-Nano \
265
+ --query-max-length 512 \
266
+ --document-max-length 1024 \
267
+ --encoder-chunk-size 4 \
268
+ --max-model-len 2048
269
+ ```
270
+
271
+ In a second terminal, check the server:
272
+
273
+ ```bash
274
+ conda activate kalm-vllm
275
+ kalm-vllm-client --base-url http://127.0.0.1:8000 --health
276
+ ```
277
+
278
+ Use `/rerank` for one query and a list of documents. Results are sorted by
279
+ score:
280
+
281
+ ```bash
282
+ kalm-vllm-client \
283
+ --base-url http://127.0.0.1:8000 \
284
+ --endpoint rerank \
285
+ --json-file ./KaLM-Reranker-V1-Nano/vllm_support/examples/rerank_request.json \
286
+ --return-margin \
287
+ --top-k 10
288
+ ```
289
+
290
+ Use `/score` to score a batch of independent query-document pairs. Results
291
+ preserve the input order and optional IDs:
292
+
293
+ ```bash
294
+ kalm-vllm-client \
295
+ --base-url http://127.0.0.1:8000 \
296
+ --endpoint score \
297
+ --json-file ./KaLM-Reranker-V1-Nano/vllm_support/examples/score_request.json \
298
+ --return-margin
299
  ```
300
 
301
  The default output is `P(yes)`. Set `return_margin=true` to also receive
302
+ `yes_logit - no_logit`; the client flag `--return-margin` applies the same
303
+ setting to a JSON file request. The supported encoder chunk sizes are
304
  `1, 2, 4, 8, 16, 32`, with `4` as the default.
305
 
306
  This adapter uses vLLM's plugin, scheduling and pooling interfaces while the