tei-triton-serving
БесплатноБез исполняемых скриптовНе проверенHigh-performance serving of embedding and reranker models in production. Covers HuggingFace Text Embeddings Inference (TEI) on GPU, Docker deployment…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
TEI, Triton, and NIM for Embedding/Reranker Serving
Embeddings and rerankers are the hottest-path CPU/GPU work in RAG. Serving them with sentence-transformers in-process or behind a plain Flask/FastAPI app leaves 3–10x throughput on the table. Three production paths:
- TEI (Text Embeddings Inference) — HuggingFace's purpose-built server for sentence-transformers/BGE/E5 and cross-encoder rerankers. Rust core, dynamic batching, ONNX + FP16 + CUDA kernels. Easiest win.
- NVIDIA Triton — general model server. Use when you need to co-serve embedding + reranker + small LLM (or ASR/CV models) behind one gateway, with ensembles and model pipelines.
- NVIDIA NIM — NVIDIA-managed containers (embedding, reranking, LLM) with OpenAI-compatible APIs. Trade vendor lock for zero ops.
TEI Quick Start
# BGE large on a single GPU
docker run -d --gpus all --shm-size 1g -p 8080:80 \
-v $PWD/data:/data \
ghcr.io/huggingface/text-embeddings-inference:latest \
--model-id BAAI/bge-large-en-v1.5 \
--max-batch-tokens 16384 \
--max-concurrent-requests 512 \
--dtype float16
Embedding call:
curl -s http://localhost:8080/embed \
-H "Content-Type: application/json" \
-d '{"inputs":["How do I rotate credentials?","What is the SLA?"]}'
OpenAI-compatible:
curl -s http://localhost:8080/v1/embeddings \
-H "Content-Type: application/json" \
-d '{"model":"bge-large","input":["hello"]}'
Cross-encoder Reranker on TEI
docker run -d --gpus all -p 8081:80 \
ghcr.io/huggingface/text-embeddings-inference:latest \
--model-id BAAI/bge-reranker-large \
--dtype float16
curl -s http://localhost:8081/rerank \
-H "Content-Type: application/json" \
-d '{"query":"rotate credentials","texts":["KMS rotates nightly","..."]}'
ONNX / CPU-friendly Builds
# Pre-quantized ONNX version of BGE-small
docker run -d -p 8080:80 \
ghcr.io/huggingface/text-embeddings-inference:cpu-latest \
--model-id BAAI/bge-small-en-v1.5 \
--pooling mean
CPU mode with INT8 ONNX gives ~200–400 QPS/core on short inputs and is plenty for low-traffic or air-gapped deployments.
Sizing
| Model | GPU | Max batch tokens | Typical p95 (batch 32) | Throughput |
|---|---|---|---|---|
| bge-small-en-v1.5 (384d) | L4 | 32768 | 25 ms | 4k docs/s |
| bge-large-en-v1.5 (1024d) | L4 | 16384 | 60 ms | 1.2k docs/s |
| bge-large-en-v1.5 | A10 | 16384 | 40 ms | 2k docs/s |
| e5-mistral-7b (4096d) | A100 | 8192 | 180 ms | 300 docs/s |
| bge-reranker-large | L4 | 16384 | 55 ms per pair batch | 400 pairs/s |
Batch size is set indirectly via --max-batch-tokens. TEI auto-batches concurrent requests up to this token budget.
TEI Client in Python
from openai import OpenAI
client = OpenAI(base_url="http://tei:80/v1", api_key="-")
vecs = client.embeddings.create(model="bge-large", input=[...]).data
Or native JSON:
import httpx
async with httpx.AsyncClient(base_url="http://tei:80") as c:
r = await c.post("/embed", json={"inputs": batch}, timeout=30.0)
vectors = r.json()
NVIDIA Triton Inference Server
Use when you need:
- Co-serving embedding + reranker + generation on one GPU pool.
- Model ensembles (Python pre/post-processing sandwiched around an engine).
- Multi-framework: TensorRT + ONNX + PyTorch under one server.
Model Repository Layout
model_repo/
bge-large/
config.pbtxt
1/
model.onnx
bge-reranker/
config.pbtxt
1/
model.onnx
rag_ensemble/
config.pbtxt # ties tokenizer -> embedder -> pooler
1/
Minimal config.pbtxt for an ONNX Embedder
name: "bge-large"
platform: "onnxruntime_onnx"
max_batch_size: 128
input [ { name: "input_ids" data_type: TYPE_INT64 dims: [ -1 ] },
{ name: "attention_mask" data_type: TYPE_INT64 dims: [ -1 ] } ]
output [ { name: "sentence_embedding" data_type: TYPE_FP16 dims: [ 1024 ] } ]
dynamic_batching {
max_queue_delay_microseconds: 2000
preferred_batch_size: [ 8, 16, 32 ]
}
instance_group [ { count: 2 kind: KIND_GPU } ]
optimization { execution_accelerators { gpu_execution_accelerator : [ {
name : "tensorrt"
parameters { key: "precision_mode" value: "FP16" }
parameters { key: "max_workspace_size_bytes" value: "4294967296" }
} ] } }
Launch
docker run --gpus all --rm -p 8000:8000 -p 8001:8001 -p 8002:8002 \
-v $PWD/model_repo:/models \
nvcr.io/nvidia/tritonserver:24.08-py3 \
tritonserver --model-repository=/models --log-verbose=1
Ports: 8000 HTTP, 8001 gRPC, 8002 metrics (Prometheus).
Python Client
import tritonclient.http as httpclient
import numpy as np
c = httpclient.InferenceServerClient("triton:8000")
ids = np.array(101, 7592, 102, dtype=np.int64)
mask = np.array(1, 1, 1, dtype=np.int64)
inputs = [
httpclient.InferInput("input_ids", ids.shape, "INT64"),
httpclient.InferInput("attention_mask", mask.shape, "INT64"),
]
inputs[0].set_data_fro
Установить tei-triton-serving в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditFAQ
Что делает скилл tei-triton-serving?
High-performance serving of embedding and reranker models in production. Covers HuggingFace Text Embeddings Inference (TEI) on GPU, Docker deployment, ONNX/FP16 quantization, dynamic batching, NVIDIA Triton for co-serving embedding + reranker + LLM, and NVIDIA NIM as a managed alternative. Benchmarks and configs. USE WHEN: user mentions "TEI", "Text Embeddings Inference", "Triton", "Triton Inference Server", "NIM", "NVIDIA NIM", "embedding server", "reranker server", "ONNX embedding", "serve BGE", "serve E5" DO NOT USE FOR: vector DB serving - use `rag-architecture`; LLM serving in general - use provider-specific docs; cost tracking - use `cost-allocation`
Как установить скилл tei-triton-serving?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tei-triton-serving запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic