feat(ml): fuse two embedding models and protect the ML service with a token

This commit is contained in:
shira committed 2026-10-11 14:40:52 +03:00
1 parent bc00d6901f
commit b24e5ff906
63 files changed
+2287 -276

No files matched your search

+12 -6
View File
@@ -4,12 +4,17 @@ services:
context: ../..
dockerfile: ml/Dockerfile
environment:
# giga loads the pinned model baked into the image; fake is the hash
# encoder for stands without the model; none keeps the service not ready.
ML_EMBEDDER: ${ML_EMBEDDER:-giga}
# A comma list of the pinned models baked into the image (giga, qwen3),
# the first one is the default; fake is the hash encoder for stands
# without the models; none keeps the service not ready. The ensemble
# policy needs giga,qwen3.
ML_EMBEDDER: ${ML_EMBEDDER:-giga,qwen3}
ML_TORCH_THREADS: ${ML_TORCH_THREADS:-4}
ML_MICRO_BATCH: ${ML_MICRO_BATCH:-1}
ML_VERIFY_WEIGHTS: ${ML_VERIFY_WEIGHTS:-true}
# The container listens on all its interfaces, so the service refuses
# to start without the shared bearer token that the backend sends.
ML_SERVICE_TOKEN: ${ML_SERVICE_TOKEN:-}
# Loopback only: the backend reaches the service over the app network by
# the alias below, never through a published port.
ports:
@@ -35,13 +40,14 @@ services:
options:
max-size: 10m
max-file: "3"
# The float32 model takes about 3.6 GiB resident with four torch threads
# (research CPU benchmark); the limits leave headroom for a request batch.
# The float32 Giga model takes about 3.6 GiB resident with four torch
# threads (research CPU benchmark) and Qwen3-Embedding about 2.5 GiB more;
# the limits leave headroom for a request batch.
deploy:
resources:
limits:
cpus: "4.0"
memory: 5G
memory: 8G
networks:
# The core project network; start the core project first (make -C deploy up).