Minimal, high-performance CPU text embedding server (Optimum-first).
A slimmed-down fork of infinity-emb focused on CPU-only text embeddings with ONNX Runtime.
- Optimum-First - ONNX Runtime is the primary engine (fast cpu inference)
- Lazy Torch - PyTorch is optional! Run totally torch-free for ~300MB image size
- Fast CPU Inference - Optimized for modern CPUs
- Dynamic Batching - High throughput with automatic batching
- OpenAI-compatible API - Drop-in replacement
Option 1: Slim (default)
ONNX-only, no torch, ~364MB uncompressed. Best for pre-exported ONNX models.
# Build
docker build -t infinity:slim .
# Run
docker run -it -p 7997:7997 infinity:slim \
v2 --model-id BAAI/bge-small-en-v1.5 --engine optimumOption 2: Full
Includes PyTorch + Optimum (~1.1GB). Supports model export and torch fallback.
# Build
docker build --build-arg ENGINE=full -t infinity:full .
# Run (can use --engine torch or --engine optimum)
docker run -it -p 7997:7997 infinity:full \
v2 --model-id BAAI/bge-small-en-v1.5 --engine torchWe recommend uv for fast installation:
# Install slim (ONNX only)
uv pip install ".[slim]"
# Install full (Torch + Optimum)
uv pip install ".[full]" \
--extra-index-url https://download.pytorch.org/whl/cpu| Engine | Description | Included in |
|---|---|---|
--engine optimum |
Default. ONNX Runtime. Fastest CPU inference. | Slim & Full |
--engine torch |
PyTorch fallback. Slower, widely compatible. | Full Only |
# Environment variables
export INFINITY_MODEL_ID="BAAI/bge-small-en-v1.5"
export INFINITY_ENGINE="optimum" # or "torch"
export INFINITY_BATCH_SIZE="32"
export INFINITY_PORT="7997"
infinity_emb v2This fork removes heavy dependencies for a minimal footprint:
- ❌ CTranslate2 engine (use Optimum instead)
- ❌ GPU support (CUDA, ROCm, TensorRT)
- ❌ Vision models (CLIP, ColPali)
- ❌ Audio models (CLAP)
- ❌ Telemetry (PostHog)
- ❌ Client library
MIT License - Based on michaelfeil/infinity