Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

infinity

> AI 编程
Open source

Infinity is a high-throughput, low-latency serving engine for text-embeddings, reranking models, clip, clap and colpali

2.9K stars0 likes1 views
WebsiteGitHub

About

Infinity is a high-throughput, low-latency serving engine for text-embeddings, reranking models, clip, clap and colpali

[![Contributors][contributors-shield]][contributors-url] [![Forks][forks-shield]][forks-url] [![Stargazers][stars-shield]][stars-url] [![Issues][issues-shield]][issues-url] [![MIT License][license-shield]][license-url]

Infinity ♾️

[![codecov][codecov-shield]][codecov-url] [![ci][ci-shield]][ci-url] [![Downloads][pepa-shield]][pepa-url]

Infinity is a high-throughput, low-latency REST API for serving text-embeddings, reranking models, clip, clap and colpali. Infinity is developed under MIT License.

Why Infinity

  • Deploy any model from HuggingFace: deploy any embedding, reranking, clip and sentence-transformer model from HuggingFace
  • Fast inference backends: The inference server is built on top of PyTorch, optimum (ONNX/TensorRT) and CTranslate2, using FlashAttention to get the most out of your NVIDIA CUDA, AMD ROCM, CPU, AWS INF2 or APPLE MPS accelerator. Infinity uses dynamic batching and tokenization dedicated in worker threads.
  • Multi-modal and multi-model: Mix-and-match multiple models. Infinity orchestrates them.
  • Tested implementation: Unit and end-to-end tested. Embeddings via infinity are correctly embedded. Lets API users create embeddings till infinity and beyond.
  • Easy to use: Built on FastAPI. Infinity CLI v2 allows launching of all arguments via Environment variable or argument. OpenAPI aligned to OpenAI's API specs. View the docs at https://michaelfeil.github.io/infinity on how to get started.

Latest News

  • [2025/07] Blackwell support
  • [2024/11] AMD, CPU, ONNX docker images
  • [2024/10] pip install infinity_client
  • [2024/07] Inference deployment example via Modal and a free GPU deployment
  • [2024/06] Support for multi-modal: clip, text-classification & launch all arguments from env variables
  • [2024/05] launch multiple models using the v2 cli, including --api-key
  • [2024/03] infinity supports experimental int8 (cpu/cuda) and fp8 (H100/MI300) support
  • [2024/03] Docs are online: https://michaelfeil.github.io/infinity/latest/
  • [2024/02] Community meetup at the Run:AI Infra Club
  • [2024/01] TensorRT / ONNX inference
  • [2023/10] Initial release

Getting started

Launch the cli via pip install

bash
pip install infinity-emb[all]

After your pip install, with your venv active, you can run the CLI directly.

bash
infinity_emb v2 --model-id BAAI/bge-small-en-v1.5

Check the v2 --help command to get a description for all parameters.

bash
infinity_emb v2 --help

Launch the CLI using a pre-built docker container (recommended)

Instead of installing the CLI via pip, you may also use docker to run michaelf34/infinity. Make sure you mount your accelerator ( i.e. install nvidia-docker and activate with --gpus all).

bash
port=7997
model1=michaelfeil/bge-small-en-v1.5
model2=mixedbread-ai/mxbai-rerank-xsmall-v1
volume=$PWD/data

docker run -it --gpus all \
 -v $volume:/app/.cache \
 -p $port:$port \
 michaelf34/infinity:latest \
 v2 \
 --model-id $model1 \
 --model-id $model2 \
 --port $port

The cache path inside the docker container is set by the environment variable HF_HOME.

Specialized docker images

Docker container for CPU Use the `latest-cpu` image or `x.x.x-cpu` for slimer image. Run like any other cpu-only docker image. Optimum/Onnx is often the prefered engine.
bash
docker run -it \
-v $volume:/app/.cache \
-p $port:$port \
michaelf34/infinity:latest-cpu \
v2 \
--engine optimum \
--model-id $model1 \
--model-id $model2 \
--port $port
Docker Container for ROCm (MI200 Series and MI300 Series) Use the `latest-rocm` image or `x.x.x-rocm` for rocm compatible inference. **This image is currently not build via CI/CD (to large), consider pinning to exact version.** Make sure you have ROCm is correctly installed and ready to use with Docker.

Visit Docs for more info.

Docker Container for Onnx-GPU, Cuda Extensions, TensorRT Use the `latest-trt-onnx` image or `x.x.x-trt-onnx` for nvidia compatible inference. **This image is currently not build via CI/CD (to large), consider pinning to exact version.**

This image has support for:

  • ONNX-Cuda "CudaExecutionProvider"
  • ONNX-TensorRT "TensorRTExecutionProvider" (may not always work due to version mismatch with ORT)
  • CudaExtensions and packages, e.g. Tri-Dao's pip install flash-attn package when using Pytorch.
  • nvcc compiler support
bash
docker run -it \
-v $volume:/app/.cache \
-p $port:$port \
michaelf34/infinity:latest-trt-onnx \
v2 \
--engine optimum \
--device cuda \
--model-id $model1 \
--port $port

Using local models with Docker container

In order to deploy a local model with a docker container, you need to mount the model inside the container and specify the path in the container to the launch command.

Example:

bash
git lfs install 
cd /tmp
mkdir models && cd models && git clone https://huggingface.co/BAAI/bge-small-en-v1.5
docker run -it   -v /tmp/models:/models  -p 8081:8081  michaelf34/infinity:latest v2  --model-id "/models/bge-small-en-v1.5" --port 8081

Advanced CLI usage

Launching multiple models at once

Since infinity_emb>=0.0.34, you can use cli v2 method to launch multiple models at the same time. Checkout infinity_emb v2 --help for all args and validation.

Multiple Model CLI Playbook:

    1. cli options can be repeated e.g. v2 --model-id model/id1 --model-id model/id2 --batch-size 8 --batch-size 4. This will create two models model/id1 and model/id2
    1. or adapt the defaults by setting ENV Variables separated by ;: INFINITY_MODEL_ID="model/id1;model/id2;" && INFINITY_BATCH_SIZE="8;4;"
    1. single items are broadcasted to --model-id length, v2 --model-id model/id1 --model-id/id2 --batch-size 8 making both models have batch-size 8.
    1. Everything is broadcasted to the number of --model-id + API requests are routed to the --served-model-name/--model-id
Using environment variables instead of the cli All CLI arguments are also launchable via environment variables.

Environment variables start with INFINITY_{UPPER_CASE_SNAKE_CASE} and often match the --{lower-case-kebab-case} cli arguments.

The following two are equivalent:

  • CLI infinity_emb v2 --model-id BAAI/bge-base-en-v1.5
  • ENV-CLI: export INFINITY_MODEL_ID="BAAI/bge-base-en-v1.5" && infinity_emb v2

Multiple arguments can be used via ; syntax: INFINITY_MODEL_ID="model/id1;model/id2;"

API Key Supply an `--api-key secret123` via CLI or ENV INFINITY_API_KEY="secret123". Chosing the fastest engine

With the command --engine torch the model must be compatible with https://github.com/UKPLab/sentence-transformers/ and AutoModel

With the command --engine optimum, there must be an onnx file. Models from https://huggingface.co/Xenova are recommended.

With the command --engine ctranslate2 - only BERT models are supported.

Telemetry opt-out

See which telemetry is collected: https://michaelfeil.eu/infinity/main/telemetry/

bash
# Disable
export INFINITY_ANONYMOUS_USAGE_STATS="0"

Supported Tasks and Models by Infinity

Infinity aims to be the inference server supporting most functionality for embeddings, reranking and related RAG tasks. The following Infinity tests 15+ architectures and all of the below cases in the Github CI. Click on the sections below to find tasks and validated example models.

Text Embeddings

Text embeddings measure the relatedness of text strings. Embeddings are used for search, clustering, recommendations. Think about a private deployed version of openai's text embeddings. https://platform.openai.com/docs/guides/embeddings

Tested embedding models:

  • mixedbread-ai/mxbai-embed-large-v1
  • WhereIsAI/UAE-Large-V1
  • BAAI/bge-base-en-v1.5
  • Alibaba-NLP/gte-large-en-v1.5
  • jinaai/jina-embeddings-v2-base-code
  • sentence-transformers/all-MiniLM-L6-v2
  • intfloat/multilingual-e5-large-instruct
  • intfloat/multilingual-e5-small
  • jinaai/jina-embeddings-v3
  • BAAI/bge-m3, no sparse
  • decoder-based models. Keep in mind that they are ~20-100x larger (&slower) than bert-small models:
    • Alibaba-NLP/gte-Qwen2-1.5B-instruct
    • Salesforce/SFR-Embedding-2_R
    • Alibaba-NLP/gte-Qwen2-7B-instruct

Other models:

  • Most embedding model are likely supported: https://huggingface.co/models?pipeline_tag=feature-extraction&other=text-embeddings-inference&sort=trending
  • Check MTEB leaderboard for models https://huggingface.co/spaces/mteb/leaderboard.
Reranking Given a query and a list of documents, Reranking indexes the documents from most to least semantically relevant to the query. Think l

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Pythonbert-embeddingsllmtext-embeddings

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.