Home/Inference & Serving/text-generation-inference
text-generation-inference logo

text-generation-inference

archived
huggingface/text-generation-inference

Large Language Model Text Generation Inference

GraphCanon updated 2w · GitHub synced 2w

11k stars1.3k forksLast push 5mo Python Apache-2.0

Decision brief

text-generation-inference

Good fit when

  • When you need hardware-accelerated performance on a variety of GPUs including NVIDIA (with CUDA 12.2 or higher), AMD ROCm, Intel GPU, Gaudi, and Google TPU.
  • If your workflow includes models from Bloom, Falcon, StarCoder, or similar transformers-based architectures that benefit from high-performance inference engines.

Avoid when

  • When the target hardware lacks GPU support or does not match the supported platforms (e.g., non-NVIDIA GPUs without ROCm setup).
  • If you need high-performance on CPUs exclusively, as TGI is designed primarily for GPU acceleration and CPU performance might be subpar.
Pricing:
freemium - Available under the Apache-2.0 license with a community-maintained open-source model.
Requirements:
Min 4 GB RAM; Requires Docker; NVIDIA GPUs require NVIDIA Container Toolkit and CUDA drivers 12.2 or higher.; AMD ROCm support requires AMD Instinct MI210 or MI250 series with appropriate setup.

Observed Jul 11, 2026 · Source: enrich:decision_facts

Verify the decision

Maintenance and security

Full trust report
Maintenance
Archived (137d since push)
As of 2w
Provenance
Not a fork · Organization account
As of 2w
Security (OSV)
No lockfile
As of 1mo

Public GitHub metadata and optional OSV scans. Signals, not a guarantee. Trust methodology.

Backing

Company context for Hugging Face. Display-only - separate from trust and ranking.

Company
Hugging Face·GitHub org profile·1mo
Employees
160·Wikidata (P1128 employees)·1mo
Funding
$235,000,000 (2023-08)·GraphCanon curated seed (public press)·1mo
Commercial model
OSS + managed cloud·GraphCanon curated seed·1mo

Install

pip install text-generation-inference
PyPI

How it fits your stack(12)

Typed graph edges - alternatives, integrations, successors, and dependencies. Ranked by relationship type, not raw GitHub stars.

Related

Relationship graph

Optional deeper exploration of typed edges and category neighbours.

Similar tools

Same-category neighbours not already linked as typed edges.

Evidence and technical details

Sourced facts, taxonomy, compatibility claims, README excerpt, and machine-readable endpoints.

Overview

Provides infrastructure for large language model inference, supporting hardware like NVIDIA GPUs, AMD ROCm, Gaudi, Intel GPU, and Google TPU.

Capability facts

Deploy
Self-host

Source: dockerfile:Dockerfile · Aug 6, 2026

Docker
Dockerfile present

Source: dockerfile:Dockerfile · Aug 6, 2026

Languages
python

Source: github.language · Aug 6, 2026

Categories

Graph entities

Compatibility

Sourced claims from the README excerpt - not unsourced marketing copy.

Python runtimePython

Source: README excerpt (regex_v1, Aug 6, 2026)

Then [install Rust](https://rustup.rs/) and create a Python virtual environment with at least
Source link

Tags

README

Hardware support


Docker

For a detailed starting guide, please see the Quick Tour. The easiest way of getting started is using the official Docker container:

model=HuggingFaceH4/zephyr-7b-beta

---

# share a volume with the Docker container to avoid downloading weights every run
volume=$PWD/data

docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data \
    ghcr.io/huggingface/text-generation-inference:3.3.5 --model-id $model

And then you can make requests like

curl 127.0.0.1:8080/generate_stream \
    -X POST \
    -d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":20}}' \
    -H 'Content-Type: application/json'

You can also use TGI's Messages API to obtain Open AI Chat Completion API compatible responses.

curl localhost:8080/v1/chat/completions \
    -X POST \
    -d '{
  "model": "tgi",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "What is deep learning?"
    }
  ],
  "stream": true,
  "max_tokens": 20
}' \
    -H 'Content-Type: application/json'

Note: To use NVIDIA GPUs, you need to install the NVIDIA Container Toolkit. We also recommend using NVIDIA drivers with CUDA version 12.2 or higher. For running the Docker container on a machine with no GPUs or CUDA support, it is enough to remove the --gpus all flag and add --disable-custom-kernels, please note CPU is not the intended platform for this project, so performance might be subpar.

Note: TGI supports AMD Instinct MI210 and MI250 GPUs. Details can be found in the Supported Hardware documentation. To use AMD GPUs, please use docker run --device /dev/kfd --device /dev/dri --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:3.3.5-rocm --model-id $model instead of the command above.

To see all options to serve your models (in the code or in the cli):

text-generation-launcher --help

Local install

You can also opt to install text-generation-inference locally.

First clone the repository and change directory into it:

git clone https://github.com/huggingface/text-generation-inference
cd text-generation-inference

Then install Rust and create a Python virtual environment with at least Python 3.9, e.g. using conda or python venv:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

#using conda
conda create -n text-generation-inference python=3.11
conda activate text-generation-inference

#using python venv
python3 -m venv .venv
source .venv/bin/activate

You may also need to install Protoc.

On Linux:

PROTOC_ZIP=protoc-21.12-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP

On MacOS, using Homebrew:

brew install protobuf

Then run:

For agents

This page has a .md twin and JSON over the API.

Was this helpful?

Anonymous feedback helps us improve pages and translations.