BGE-M3 sparse embeddings for vLLM: IO processor plugin + Portainer stack
Adds a vllm.io_processor_plugins entry point (bge_m3_sparse_plugin) that serves learned sparse vectors of BAAI/bge-m3 over POST /pooling, on top of the BgeM3EmbeddingModel architecture that already ships with vLLM. - plugin/: python package, sparse (token_classify) and dense (embed) modes, batch support, per-request weight threshold - entrypoint.sh: pip install the plugin from a read-only mount at container start - docker-compose.yml: stack ready for Portainer (git repository deployment) Verified against vLLM 0.30.0 on an RTX 5070: single/batch/parallel requests, validation errors, and weights matching the FlagEmbedding reference formula.
This commit is contained in:
commit
1c533f98f0
8 files changed
+562
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Installs the BGE-M3 sparse IO processor plugin from /opt/plugin (or $PLUGIN_SRC)
|
||||
# and then hands control over to the vLLM API server.
|
||||
#
|
||||
# The plugin lives in a python distribution, because vLLM discovers IO
|
||||
# processors through entry points (group "vllm.io_processor_plugins"), so a
|
||||
# plain PYTHONPATH mount is not enough.
|
||||
set -euo pipefail
|
||||
|
||||
PLUGIN_SRC="${PLUGIN_SRC:-/opt/plugin}"
|
||||
PLUGIN_NAME="bge_m3_sparse_plugin"
|
||||
|
||||
if [ -d "$PLUGIN_SRC" ]; then
|
||||
# pip needs a writable copy to build the wheel, so the git mount stays read-only
|
||||
rm -rf /tmp/bge-m3-sparse-plugin
|
||||
cp -r "$PLUGIN_SRC" /tmp/bge-m3-sparse-plugin
|
||||
python3 -m pip install \
|
||||
--no-deps \
|
||||
--no-build-isolation \
|
||||
--no-cache-dir \
|
||||
--disable-pip-version-check \
|
||||
--quiet \
|
||||
/tmp/bge-m3-sparse-plugin
|
||||
python3 - <<'PY'
|
||||
from importlib.metadata import entry_points
|
||||
|
||||
found = [f"{ep.name} -> {ep.value}" for ep in entry_points(group="vllm.io_processor_plugins")]
|
||||
print(f"[bge-m3-sparse] io processor plugins: {found}", flush=True)
|
||||
PY
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in new issue
Block a user