Commit Graph
5 Commits
Author SHA1 Message Date
opencode 51fe7873c5 Plugin: chunk long documents and return one merged vector
Previously a document longer than --max-model-len got HTTP 400. Now pre_process
splits text into overlapping token windows (offsets from the fast tokenizer,
recursively halved if a piece still does not fit) and post_process merges the
per chunk results, so the client always receives one vector per input text.

- new request fields: chunk_tokens (default: only chunk what does not fit,
  window = max_model_len - 8), chunk_overlap (128), merge (max/sum/mean,
  sparse defaults to max, dense to mean + renormalise)
- response gains chunks, merge, chunk_tokens, chunk_overlap
- dense chunked output stays L2 normalised (norm 1.0000)
- regression: texts that fit are still processed as a single chunk with the
  same weights as before (verified against the FlagEmbedding reference)

Measured on the GPU stand: 100k characters -> 3 chunks in 0.8 s, 0.6 s with
chunk_tokens=1024 (48 chunks); chunking a 1.1k token text into 400-token
windows keeps 92% of the whole-document tokens (dot 0.481).

Adds sync_cpu_compose.py: docker-compose.cpu.yml is now generated from
docker-compose.yml, so the two embedded copies of the plugin cannot drift
(--check mode for CI). smoke_test.py covers chunking, merge modes and grouping.
2026-10-07 09:15:41 +07:00
opencode 93ddb52bff Pin image tag to v0.30.0, document 'context deadline exceeded'
The failing deploy on a fresh host is almost always the vLLM image pull
(~31 GB unpacked) hitting Portainer's stack deploy timeout. Documented
pre-pulling on the target host plus docker save|load alternative, and
replaced the :latest default with the exact tag this stack was tested on.
2026-10-05 09:01:24 +07:00
opencode 17f7c92b47 Make the stack self-contained (fixes 'entrypoint.sh: Is a directory')
Portainer's web editor has no repo checkout on the host, so relative bind
mounts turned into empty directories. The compose file no longer mounts
anything except the HF cache: the plugin is now written with heredocs and
pip-installed inside the container.

Also fixes two compose-specific traps: $ must be escaped as $$ (compose
interpolates values), and command has to be a single-element list (otherwise
compose splits the script and bash runs a bare 'set').
2026-09-28 14:08:12 +07:00
AINS 74a11537e7 compose: make container name configurable via CONTAINER_NAME 2026-09-28 13:54:35 +07:00
opencode 1c533f98f0 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.
2026-09-28 13:54:20 +07:00