{"id":13408980,"url":"https://github.com/huggingface/text-embeddings-inference","last_synced_at":"2026-02-25T13:10:59.414Z","repository":{"id":199996107,"uuid":"704543233","full_name":"huggingface/text-embeddings-inference","owner":"huggingface","description":"A blazing fast inference solution for text embeddings models","archived":false,"fork":false,"pushed_at":"2025-04-23T09:02:54.000Z","size":2057,"stargazers_count":3474,"open_issues_count":126,"forks_count":249,"subscribers_count":40,"default_branch":"main","last_synced_at":"2025-04-25T14:49:25.938Z","etag":null,"topics":["ai","embeddings","huggingface","llm","ml"],"latest_commit_sha":null,"homepage":"https://huggingface.co/docs/text-embeddings-inference/quick_tour","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huggingface.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-13T13:36:51.000Z","updated_at":"2025-04-25T11:14:03.000Z","dependencies_parsed_at":"2023-10-26T18:37:13.791Z","dependency_job_id":"6c7a2fc7-dae9-4170-bcc2-1e568e7b5016","html_url":"https://github.com/huggingface/text-embeddings-inference","commit_stats":null,"previous_names":["huggingface/text-embeddings-inference"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Ftext-embeddings-inference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Ftext-embeddings-inference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Ftext-embeddings-inference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Ftext-embeddings-inference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huggingface","download_url":"https://codeload.github.com/huggingface/text-embeddings-inference/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969248,"owners_count":21992263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","embeddings","huggingface","llm","ml"],"created_at":"2024-07-30T20:00:57.059Z","updated_at":"2026-02-25T13:10:59.408Z","avatar_url":"https://github.com/huggingface.png","language":"Rust","funding_links":[],"categories":["Models and Tools","Rust","文本匹配 文本检索 文本相似度","LLM Deployment","5. Retrieval-Augmented Generation (RAG) \u0026 Knowledge","Llm Tools","Serving","HarmonyOS","LLM Inference","Tools \u0026 Evaluation"],"sub_categories":["Embeddings","其他_文本生成、文本对话","Large Model Serving","Windows Manager","Local Inference"],"readme":"\u003cdiv align=\"center\"\u003e\n\n# Text Embeddings Inference\n\n\u003ca href=\"https://github.com/huggingface/text-embeddings-inference\"\u003e\n  \u003cimg alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/huggingface/text-embeddings-inference?style=social\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://huggingface.github.io/text-embeddings-inference\"\u003e\n  \u003cimg alt=\"Swagger API documentation\" src=\"https://img.shields.io/badge/API-Swagger-informational\"\u003e\n\u003c/a\u003e\n\nA blazing fast inference solution for text embeddings models.\n\nBenchmark for [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) on an NVIDIA A10 with a sequence\nlength of 512 tokens:\n\n\u003cp\u003e\n  \u003cimg src=\"assets/bs1-lat.png\" width=\"400\" /\u003e\n  \u003cimg src=\"assets/bs1-tp.png\" width=\"400\" /\u003e\n\u003c/p\u003e\n\u003cp\u003e\n  \u003cimg src=\"assets/bs32-lat.png\" width=\"400\" /\u003e\n  \u003cimg src=\"assets/bs32-tp.png\" width=\"400\" /\u003e\n\u003c/p\u003e\n\n\u003c/div\u003e\n\n## Table of contents\n\n- [Get Started](#get-started)\n    - [Supported Models](#supported-models)\n    - [Docker](#docker)\n    - [Docker Images](#docker-images)\n    - [API Documentation](#api-documentation)\n    - [Using a private or gated model](#using-a-private-or-gated-model)\n    - [Air gapped deployment](#air-gapped-deployment)\n    - [Using Re-rankers models](#using-re-rankers-models)\n    - [Using Sequence Classification models](#using-sequence-classification-models)\n    - [Using SPLADE pooling](#using-splade-pooling)\n    - [Distributed Tracing](#distributed-tracing)\n    - [gRPC](#grpc)\n- [Local Install](#local-install)\n    - [Apple Silicon (Homebrew)](#apple-silicon-homebrew)\n- [Docker Build](#docker-build)\n    - [Apple M1/M2 Arm](#apple-m1m2-arm64-architectures)\n- [Examples](#examples)\n\nText Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence\nclassification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding,\nEmber, GTE and E5. TEI implements many features such as:\n\n* No model graph compilation step\n* Metal support for local execution on Macs\n* Small docker images and fast boot times. Get ready for true serverless!\n* Token based dynamic batching\n* Optimized transformers code for inference using [Flash Attention](https://github.com/HazyResearch/flash-attention),\n  [Candle](https://github.com/huggingface/candle)\n  and [cuBLASLt](https://docs.nvidia.com/cuda/cublas/#using-the-cublaslt-api)\n* [Safetensors](https://github.com/huggingface/safetensors) weight loading\n* [ONNX](https://github.com/onnx/onnx) weight loading\n* Production ready (distributed tracing with Open Telemetry, Prometheus metrics)\n\n## Get Started\n\n### Supported Models\n\n#### Text Embeddings\n\nText Embeddings Inference currently supports Nomic, BERT, CamemBERT, XLM-RoBERTa models with absolute positions, JinaBERT\nmodel with Alibi positions and Mistral, Alibaba GTE, Qwen2 models with Rope positions, MPNet, ModernBERT, Qwen3, and Gemma3.\n\nBelow are some examples of the currently supported models:\n\n| MTEB Rank | Model Size             | Model Type     | Model ID                                                                                         |\n|-----------|------------------------|----------------|--------------------------------------------------------------------------------------------------|\n| 2         | 7.57B (Very Expensive) | Qwen3          | [Qwen/Qwen3-Embedding-8B](https://hf.co/Qwen/Qwen3-Embedding-8B)                                 |\n| 3         | 4.02B (Very Expensive) | Qwen3          | [Qwen/Qwen3-Embedding-4B](https://hf.co/Qwen/Qwen3-Embedding-4B)                                 |\n| 4         | 509M                   | Qwen3          | [Qwen/Qwen3-Embedding-0.6B](https://hf.co/Qwen/Qwen3-Embedding-0.6B)                             |\n| 6         | 7.61B (Very Expensive) | Qwen2          | [Alibaba-NLP/gte-Qwen2-7B-instruct](https://hf.co/Alibaba-NLP/gte-Qwen2-7B-instruct)             |\n| 7         | 560M                   | XLM-RoBERTa    | [intfloat/multilingual-e5-large-instruct](https://hf.co/intfloat/multilingual-e5-large-instruct) |\n| 8         | 308M                   | Gemma3         | [google/embeddinggemma-300m](https://hf.co/google/embeddinggemma-300m) (gated)                   |\n| 15        | 1.78B (Expensive)      | Qwen2          | [Alibaba-NLP/gte-Qwen2-1.5B-instruct](https://hf.co/Alibaba-NLP/gte-Qwen2-1.5B-instruct)         |\n| 18        | 7.11B (Very Expensive) | Mistral        | [Salesforce/SFR-Embedding-2_R](https://hf.co/Salesforce/SFR-Embedding-2_R)                       |\n| 35        | 568M                   | XLM-RoBERTa    | [Snowflake/snowflake-arctic-embed-l-v2.0](https://hf.co/Snowflake/snowflake-arctic-embed-l-v2.0) |\n| 41        | 305M                   | Alibaba GTE    | [Snowflake/snowflake-arctic-embed-m-v2.0](https://hf.co/Snowflake/snowflake-arctic-embed-m-v2.0) |\n| 52        | 335M                   | BERT           | [WhereIsAI/UAE-Large-V1](https://hf.co/WhereIsAI/UAE-Large-V1)                                   |\n| 58        | 137M                   | NomicBERT      | [nomic-ai/nomic-embed-text-v1](https://hf.co/nomic-ai/nomic-embed-text-v1)                       |\n| 79        | 137M                   | NomicBERT      | [nomic-ai/nomic-embed-text-v1.5](https://hf.co/nomic-ai/nomic-embed-text-v1.5)                   |\n| 103       | 109M                   | MPNet          | [sentence-transformers/all-mpnet-base-v2](https://hf.co/sentence-transformers/all-mpnet-base-v2) |\n| N/A       | 475M-A305M             | NomicBERT      | [nomic-ai/nomic-embed-text-v2-moe](https://hf.co/nomic-ai/nomic-embed-text-v2-moe)               |\n| N/A       | 434M                   | Alibaba GTE    | [Alibaba-NLP/gte-large-en-v1.5](https://hf.co/Alibaba-NLP/gte-large-en-v1.5)                     |\n| N/A       | 396M                   | ModernBERT     | [answerdotai/ModernBERT-large](https://hf.co/answerdotai/ModernBERT-large)                       |\n| N/A       | 340M                   | Qwen3          | [voyageai/voyage-4-nano](https://hf.co/voyageai/voyage-4-nano)                                   |\n| N/A       | 137M                   | JinaBERT       | [jinaai/jina-embeddings-v2-base-en](https://hf.co/jinaai/jina-embeddings-v2-base-en)             |\n| N/A       | 137M                   | JinaBERT       | [jinaai/jina-embeddings-v2-base-code](https://hf.co/jinaai/jina-embeddings-v2-base-code)         |\n\nTo explore the list of best performing text embeddings models, visit the\n[Massive Text Embedding Benchmark (MTEB) Leaderboard](https://huggingface.co/spaces/mteb/leaderboard).\n\n#### Sequence Classification and Re-Ranking\n\nText Embeddings Inference currently supports CamemBERT, and XLM-RoBERTa Sequence Classification models with absolute positions.\n\nBelow are some examples of the currently supported models:\n\n| Task               | Model Type  | Model ID                                                                                                        |\n|--------------------|-------------|-----------------------------------------------------------------------------------------------------------------|\n| Re-Ranking         | XLM-RoBERTa | [BAAI/bge-reranker-large](https://huggingface.co/BAAI/bge-reranker-large)                                       |\n| Re-Ranking         | XLM-RoBERTa | [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base)                                         |\n| Re-Ranking         | GTE         | [Alibaba-NLP/gte-multilingual-reranker-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-reranker-base) |\n| Re-Ranking         | ModernBert  | [Alibaba-NLP/gte-reranker-modernbert-base](https://huggingface.co/Alibaba-NLP/gte-reranker-modernbert-base) |\n| Sentiment Analysis | RoBERTa     | [SamLowe/roberta-base-go_emotions](https://huggingface.co/SamLowe/roberta-base-go_emotions)                     |\n\n### Docker\n\n```shell\nmodel=Qwen/Qwen3-Embedding-0.6B\nvolume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run\n\ndocker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id $model\n```\n\nAnd then you can make requests like\n\n```bash\ncurl 127.0.0.1:8080/embed \\\n    -X POST \\\n    -d '{\"inputs\":\"What is Deep Learning?\"}' \\\n    -H 'Content-Type: application/json'\n```\n\n**Note:** To use GPUs, you need to install\nthe [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html).\nNVIDIA drivers on your machine need to be compatible with CUDA version 12.2 or higher.\n\nTo see all options to serve your models:\n\n```console\n$ text-embeddings-router --help\nText Embedding Webserver\n\nUsage: text-embeddings-router [OPTIONS] --model-id \u003cMODEL_ID\u003e\n\nOptions:\n      --model-id \u003cMODEL_ID\u003e\n          The Hugging Face model ID, can be any model listed on \u003chttps://huggingface.co/models\u003e with the `text-embeddings-inference` tag (meaning it's compatible with Text Embeddings Inference).\n\n          Alternatively, the specified ID can also be a path to a local directory containing the necessary model files saved by the `save_pretrained(...)` methods of either Transformers or Sentence Transformers.\n\n          [env: MODEL_ID=]\n\n      --revision \u003cREVISION\u003e\n          The actual revision of the model if you're referring to a model on the hub. You can use a specific commit id or a branch like `refs/pr/2`\n\n          [env: REVISION=]\n\n      --tokenization-workers \u003cTOKENIZATION_WORKERS\u003e\n          Optionally control the number of tokenizer workers used for payload tokenization, validation and truncation. Default to the number of CPU cores on the machine\n\n          [env: TOKENIZATION_WORKERS=]\n\n      --dtype \u003cDTYPE\u003e\n          The dtype to be forced upon the model\n\n          [env: DTYPE=]\n          [possible values: float16, float32]\n\n      --served-model-name \u003cSERVED_MODEL_NAME\u003e\n          The name of the model that is being served. If not specified, defaults to `--model-id`. It is only used for the OpenAI-compatible endpoints via HTTP\n\n          [env: SERVED_MODEL_NAME=]\n\n      --pooling \u003cPOOLING\u003e\n          Optionally control the pooling method for embedding models.\n\n          If `pooling` is not set, the pooling configuration will be parsed from the model `1_Pooling/config.json` configuration.\n\n          If `pooling` is set, it will override the model pooling configuration\n\n          [env: POOLING=]\n\n          Possible values:\n          - cls:        Select the CLS token as embedding\n          - mean:       Apply Mean pooling to the model embeddings\n          - splade:     Apply SPLADE (Sparse Lexical and Expansion) to the model embeddings. This option is only available if the loaded model is a `ForMaskedLM` Transformer model\n          - last-token: Select the last token as embedding\n\n      --max-concurrent-requests \u003cMAX_CONCURRENT_REQUESTS\u003e\n          The maximum amount of concurrent requests for this particular deployment. Having a low limit will refuse clients requests instead of having them wait for too long and is usually good to handle backpressure correctly\n\n          [env: MAX_CONCURRENT_REQUESTS=]\n          [default: 512]\n\n      --max-batch-tokens \u003cMAX_BATCH_TOKENS\u003e\n          **IMPORTANT** This is one critical control to allow maximum usage of the available hardware.\n\n          This represents the total amount of potential tokens within a batch.\n\n          For `max_batch_tokens=1000`, you could fit `10` queries of `total_tokens=100` or a single query of `1000` tokens.\n\n          Overall this number should be the largest possible until the model is compute bound. Since the actual memory overhead depends on the model implementation, text-embeddings-inference cannot infer this number automatically.\n\n          [env: MAX_BATCH_TOKENS=]\n          [default: 16384]\n\n      --max-batch-requests \u003cMAX_BATCH_REQUESTS\u003e\n          Optionally control the maximum number of individual requests in a batch\n\n          [env: MAX_BATCH_REQUESTS=]\n\n      --max-client-batch-size \u003cMAX_CLIENT_BATCH_SIZE\u003e\n          Control the maximum number of inputs that a client can send in a single request\n\n          [env: MAX_CLIENT_BATCH_SIZE=]\n          [default: 32]\n\n      --auto-truncate\n          Control automatic truncation of inputs that exceed the model's maximum supported size. Defaults to `true` (truncation enabled). Set to `false` to disable truncation; when disabled and the model's maximum input length exceeds `--max-batch-tokens`, the server will refuse to start with an error instead of silently truncating sequences.\n\n          Unused for gRPC servers\n\n          [env: AUTO_TRUNCATE=]\n\n      --default-prompt-name \u003cDEFAULT_PROMPT_NAME\u003e\n          The name of the prompt that should be used by default for encoding. If not set, no prompt will be applied.\n\n          Must be a key in the `sentence-transformers` configuration `prompts` dictionary.\n\n          For example if ``default_prompt_name`` is \"query\" and the ``prompts`` is {\"query\": \"query: \", ...}, then the sentence \"What is the capital of France?\" will be encoded as \"query: What is the capital of France?\" because the prompt text will be prepended before any text to encode.\n\n          The argument '--default-prompt-name \u003cDEFAULT_PROMPT_NAME\u003e' cannot be used with '--default-prompt \u003cDEFAULT_PROMPT\u003e`\n\n          [env: DEFAULT_PROMPT_NAME=]\n\n      --default-prompt \u003cDEFAULT_PROMPT\u003e\n          The prompt that should be used by default for encoding. If not set, no prompt will be applied.\n\n          For example if ``default_prompt`` is \"query: \" then the sentence \"What is the capital of France?\" will be encoded as \"query: What is the capital of France?\" because the prompt text will be prepended before any text to encode.\n\n          The argument '--default-prompt \u003cDEFAULT_PROMPT\u003e' cannot be used with '--default-prompt-name \u003cDEFAULT_PROMPT_NAME\u003e`\n\n          [env: DEFAULT_PROMPT=]\n\n      --dense-path \u003cDENSE_PATH\u003e\n          Optionally, define the path to the Dense module required for some embedding models.\n\n          Some embedding models require an extra `Dense` module which contains a single Linear layer and an activation function. By default, those `Dense` modules are stored under the `2_Dense` directory, but there might be cases where different `Dense` modules are provided, to convert the pooled embeddings into different dimensions, available as `2_Dense_\u003cdims\u003e` e.g. https://huggingface.co/NovaSearch/stella_en_400M_v5.\n\n          Note that this argument is optional, only required to be set if there is no `modules.json` file or when you want to override a single Dense module path, only when running with the `candle` backend.\n\n          [env: DENSE_PATH=]\n\n      --hf-token \u003cHF_TOKEN\u003e\n          Your Hugging Face Hub token. If neither `--hf-token` nor `HF_TOKEN` are set, the token will be read from the `$HF_HOME/token` path, if it exists. This ensures access to private or gated models, and allows for a more permissive rate limiting\n\n          [env: HF_TOKEN=]\n\n      --hostname \u003cHOSTNAME\u003e\n          The IP address to listen on\n\n          [env: HOSTNAME=]\n          [default: 0.0.0.0]\n\n      -p, --port \u003cPORT\u003e\n          The port to listen on\n\n          [env: PORT=]\n          [default: 3000]\n\n      --uds-path \u003cUDS_PATH\u003e\n          The name of the unix socket some text-embeddings-inference backends will use as they communicate internally with gRPC\n\n          [env: UDS_PATH=]\n          [default: /tmp/text-embeddings-inference-server]\n\n      --huggingface-hub-cache \u003cHUGGINGFACE_HUB_CACHE\u003e\n          The location of the huggingface hub cache. Used to override the location if you want to provide a mounted disk for instance\n\n          [env: HUGGINGFACE_HUB_CACHE=]\n\n      --payload-limit \u003cPAYLOAD_LIMIT\u003e\n          Payload size limit in bytes\n\n          Default is 2MB\n\n          [env: PAYLOAD_LIMIT=]\n          [default: 2000000]\n\n      --api-key \u003cAPI_KEY\u003e\n          Set an api key for request authorization.\n\n          By default the server responds to every request. With an api key set, the requests must have the Authorization header set with the api key as Bearer token.\n\n          [env: API_KEY=]\n\n      --json-output\n          Outputs the logs in JSON format (useful for telemetry)\n\n          [env: JSON_OUTPUT=]\n\n      --disable-spans\n          Whether or not to include the log trace through spans\n\n          [env: DISABLE_SPANS=]\n\n      --otlp-endpoint \u003cOTLP_ENDPOINT\u003e\n          The grpc endpoint for opentelemetry. Telemetry is sent to this endpoint as OTLP over gRPC. e.g. `http://localhost:4317`\n\n          [env: OTLP_ENDPOINT=]\n\n      --otlp-service-name \u003cOTLP_SERVICE_NAME\u003e\n          The service name for opentelemetry. e.g. `text-embeddings-inference.server`\n\n          [env: OTLP_SERVICE_NAME=]\n          [default: text-embeddings-inference.server]\n\n      --prometheus-port \u003cPROMETHEUS_PORT\u003e\n          The Prometheus port to listen on\n\n          [env: PROMETHEUS_PORT=]\n          [default: 9000]\n\n      --cors-allow-origin \u003cCORS_ALLOW_ORIGIN\u003e\n          Unused for gRPC servers\n\n          [env: CORS_ALLOW_ORIGIN=]\n\n  -h, --help\n          Print help (see a summary with '-h')\n\n  -V, --version\n          Print version\n```\n\n### Docker Images\n\nText Embeddings Inference ships with multiple Docker images that you can use to target a specific backend:\n\n| Architecture                           | Image                                                                   |\n|----------------------------------------|-------------------------------------------------------------------------|\n| CPU                                    | ghcr.io/huggingface/text-embeddings-inference:cpu-1.9                   |\n| Volta                                  | NOT SUPPORTED                                                           |\n| Turing (T4, RTX 2000 series, ...)      | ghcr.io/huggingface/text-embeddings-inference:turing-1.9 (experimental) |\n| Ampere 8.0 (A100, A30)                 | ghcr.io/huggingface/text-embeddings-inference:1.9                       |\n| Ampere 8.6 (A10, A40, ...)             | ghcr.io/huggingface/text-embeddings-inference:86-1.9                    |\n| Ada Lovelace (RTX 4000 series, ...)    | ghcr.io/huggingface/text-embeddings-inference:89-1.9                    |\n| Hopper (H100)                          | ghcr.io/huggingface/text-embeddings-inference:hopper-1.9                |\n| Blackwell 10.0 (B200, GB200, ...)      | ghcr.io/huggingface/text-embeddings-inference:100-1.9 (experimental)    |\n| Blackwell 12.0 (GeForce RTX 50X0, ...) | ghcr.io/huggingface/text-embeddings-inference:120-1.9 (experimental)    |\n\n**Warning**: Flash Attention is turned off by default for the Turing image as it suffers from precision issues.\nYou can turn Flash Attention v1 ON by using the `USE_FLASH_ATTENTION=True` environment variable.\n\n### API documentation\n\nYou can consult the OpenAPI documentation of the `text-embeddings-inference` REST API using the `/docs` route.\nThe Swagger UI is also available\nat: [https://huggingface.github.io/text-embeddings-inference](https://huggingface.github.io/text-embeddings-inference).\n\n### Using a private or gated model\n\nYou have the option to utilize the `HF_TOKEN` environment variable for configuring the token employed by\n`text-embeddings-inference`. This allows you to gain access to protected resources.\n\nFor example:\n\n1. Go to https://huggingface.co/settings/tokens\n2. Copy your CLI READ token\n3. Export `HF_TOKEN=\u003cyour CLI READ token\u003e`\n\nor with Docker:\n\n```shell\nmodel=\u003cyour private model\u003e\nvolume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run\ntoken=\u003cyour CLI READ token\u003e\n\ndocker run --gpus all -e HF_TOKEN=$token -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id $model\n```\n\n### Air gapped deployment\n\nTo deploy Text Embeddings Inference in an air-gapped environment, first download the weights and then mount them inside\nthe container using a volume.\n\nFor example:\n\n```shell\n# (Optional) create a `models` directory\nmkdir models\ncd models\n\n# Make sure you have git-lfs installed (https://git-lfs.com)\ngit lfs install\ngit clone https://huggingface.co/Qwen/Qwen3-Embedding-0.6B\n\n# Set the models directory as the volume path\nvolume=$PWD\n\n# Mount the models directory inside the container with a volume and set the model ID\ndocker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id /data/Qwen3-Embedding-0.6B\n```\n\n### Using Re-rankers models\n\n`text-embeddings-inference` v0.4.0 added support for CamemBERT, RoBERTa, XLM-RoBERTa, and GTE Sequence Classification models.\nRe-rankers models are Sequence Classification cross-encoders models with a single class that scores the similarity\nbetween a query and a text.\n\nSee [this blogpost](https://blog.llamaindex.ai/boosting-rag-picking-the-best-embedding-reranker-models-42d079022e83) by\nthe LlamaIndex team to understand how you can use re-rankers models in your RAG pipeline to improve\ndownstream performance.\n\n```shell\nmodel=BAAI/bge-reranker-large\nvolume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run\n\ndocker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id $model\n```\n\nAnd then you can rank the similarity between a query and a list of texts with:\n\n```bash\ncurl 127.0.0.1:8080/rerank \\\n    -X POST \\\n    -d '{\"query\": \"What is Deep Learning?\", \"texts\": [\"Deep Learning is not...\", \"Deep learning is...\"]}' \\\n    -H 'Content-Type: application/json'\n```\n\n### Using Sequence Classification models\n\nYou can also use classic Sequence Classification models like `SamLowe/roberta-base-go_emotions`:\n\n```shell\nmodel=SamLowe/roberta-base-go_emotions\nvolume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run\n\ndocker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id $model\n```\n\nOnce you have deployed the model you can use the `predict` endpoint to get the emotions most associated with an input:\n\n```bash\ncurl 127.0.0.1:8080/predict \\\n    -X POST \\\n    -d '{\"inputs\":\"I like you.\"}' \\\n    -H 'Content-Type: application/json'\n```\n\n### Using SPLADE pooling\n\nYou can choose to activate SPLADE pooling for Bert and Distilbert MaskedLM architectures:\n\n```shell\nmodel=naver/efficient-splade-VI-BT-large-query\nvolume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run\n\ndocker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9 --model-id $model --pooling splade\n```\n\nOnce you have deployed the model you can use the `/embed_sparse` endpoint to get the sparse embedding:\n\n```bash\ncurl 127.0.0.1:8080/embed_sparse \\\n    -X POST \\\n    -d '{\"inputs\":\"I like you.\"}' \\\n    -H 'Content-Type: application/json'\n```\n\n### Distributed Tracing\n\n`text-embeddings-inference` is instrumented with distributed tracing using OpenTelemetry. You can use this feature\nby setting the address to an OTLP collector with the `--otlp-endpoint` argument.\n\n### gRPC\n\n`text-embeddings-inference` offers a gRPC API as an alternative to the default HTTP API for high performance\ndeployments. The API protobuf definition can be\nfound [here](https://github.com/huggingface/text-embeddings-inference/blob/main/proto/tei.proto).\n\nYou can use the gRPC API by adding the `-grpc` tag to any TEI Docker image. For example:\n\n```shell\nmodel=Qwen/Qwen3-Embedding-0.6B\nvolume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run\n\ndocker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:cuda-1.9-grpc --model-id $model\n```\n\n```shell\ngrpcurl -d '{\"inputs\": \"What is Deep Learning\"}' -plaintext 0.0.0.0:8080 tei.v1.Embed/Embed\n```\n\n## Local install\n\n### Apple Silicon (Homebrew)\n\nOn Apple Silicon (M1/M2/M3/M4), you can install a prebuilt binary via Homebrew:\n\n```shell\nbrew install text-embeddings-inference\n```\n\nThen launch Text Embeddings Inference with Metal acceleration:\n\n```shell\nmodel=Qwen/Qwen3-Embedding-0.6B\n\ntext-embeddings-router --model-id $model --port 8080\n```\n\n### CPU\n\nYou can also opt to install `text-embeddings-inference` locally.\n\nFirst [install Rust](https://rustup.rs/):\n\n```shell\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\nThen run:\n\n```shell\n# On x86 with ONNX backend (recommended)\ncargo install --path router -F ort\n# On x86 with Intel backend\ncargo install --path router -F mkl\n# On M1 or M2\ncargo install --path router -F metal\n```\n\nYou can now launch Text Embeddings Inference on CPU with:\n\n```shell\nmodel=Qwen/Qwen3-Embedding-0.6B\n\ntext-embeddings-router --model-id $model --port 8080\n```\n\n**Note:** on some machines, you may also need the OpenSSL libraries and gcc. On Linux machines, run:\n\n```shell\nsudo apt-get install libssl-dev gcc -y\n```\n\n### CUDA\n\nGPUs with CUDA compute capabilities \u003c 7.5 are not supported (V100, Titan V, GTX 1000 series, ...).\n\nMake sure you have CUDA and the NVIDIA drivers installed. NVIDIA drivers on your device need to be compatible with CUDA\nversion 12.2 or higher. You also need to add the NVIDIA binaries to your path:\n\n```shell\nexport PATH=$PATH:/usr/local/cuda/bin\n```\n\nThen run the following (might take a while as it needs to compile the CUDA kernels):\n\n```shell\n# On Turing GPUs (T4, RTX 2000 series ... )\ncargo install --path router -F candle-cuda-turing\n\n# On Ampere, Ada Lovelace, Hopper and Blackwell\ncargo install --path router -F candle-cuda\n```\n\nYou can now launch Text Embeddings Inference on GPU as follows:\n\n```shell\nmodel=Qwen/Qwen3-Embedding-0.6B\n\ntext-embeddings-router --model-id $model --port 8080\n```\n\n## Docker\n\nYou can build the CPU container with Docker as:\n\n```shell\ndocker build -f Dockerfile .\n```\n\nTo build the CUDA containers, you need to know the compute cap of the GPU you will be using\nat runtime, to build the image accordingly:\n\n```shell\n# Get submodule dependencies\ngit submodule update --init\n\n# Example for Turing (T4, RTX 2000 series, ...)\nruntime_compute_cap=75\n\n# Example for Ampere (A100, ...)\nruntime_compute_cap=80\n\n# Example for Ampere (A10, ...)\nruntime_compute_cap=86\n\n# Example for Ada Lovelace (RTX 4000 series, ...)\nruntime_compute_cap=89\n\n# Example for Hopper (H100, ...)\nruntime_compute_cap=90\n\n# Example for Blackwell (B200, GB200, ...)\nruntime_compute_cap=100\n\n# Example for Blackwell (GeForce RTX 50X0, RTX PRO 6000, ...)\nruntime_compute_cap=120\n\ndocker build . -f Dockerfile-cuda --build-arg CUDA_COMPUTE_CAP=$runtime_compute_cap\n```\n\n### Apple M1/M2 arm64 architectures\n\n#### DISCLAIMER\n\nAs explained here [MPS-Ready, ARM64 Docker Image](https://github.com/pytorch/pytorch/issues/81224), Metal / MPS is not\nsupported via Docker. As such inference will be CPU bound and most likely pretty slow when using this docker image on an\nM1/M2 ARM CPU.\n\n```\ndocker build . -f Dockerfile --platform=linux/arm64\n```\n\n## Examples\n\n- [Set up an Inference Endpoint with TEI](https://huggingface.co/learn/cookbook/automatic_embedding_tei_inference_endpoints)\n- [RAG containers with TEI](https://github.com/plaggy/rag-containers)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Ftext-embeddings-inference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuggingface%2Ftext-embeddings-inference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Ftext-embeddings-inference/lists"}