Skip to content

Commit c9813b9

Browse files
committed
Other minor updates.
1 parent 27daf69 commit c9813b9

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<img alt="Swagger API documentation" src="https://img.shields.io/badge/API-Swagger-informational">
1414
</a>
1515

16-
A Rust, Python and gRPC server for text generation inference. Used in production at [HuggingFace](https://huggingface.co)
16+
A Rust, Python and gRPC server for text generation inference. Used in production at [Hugging Face](https://huggingface.co)
1717
to power Hugging Chat, the Inference API and Inference Endpoint.
1818

1919
</div>
@@ -42,14 +42,15 @@ Text Generation Inference (TGI) is a toolkit for deploying and serving Large Lan
4242
- Tensor Parallelism for faster inference on multiple GPUs
4343
- Token streaming using Server-Sent Events (SSE)
4444
- Continuous batching of incoming requests for increased total throughput
45+
- [Messages API](https://huggingface.co/docs/text-generation-inference/en/messages_api) compatible with Open AI Chat Completion API
4546
- Optimized transformers code for inference using [Flash Attention](https://github.com/HazyResearch/flash-attention) and [Paged Attention](https://github.com/vllm-project/vllm) on the most popular architectures
4647
- Quantization with :
4748
- [bitsandbytes](https://github.com/TimDettmers/bitsandbytes)
4849
- [GPT-Q](https://arxiv.org/abs/2210.17323)
4950
- [EETQ](https://github.com/NetEase-FuXi/EETQ)
5051
- [AWQ](https://github.com/casper-hansen/AutoAWQ)
5152
- [Marlin](https://github.com/IST-DASLab/marlin)
52-
- [fp8]()
53+
- [fp8](https://developer.nvidia.com/blog/nvidia-arm-and-intel-publish-fp8-specification-for-standardization-as-an-interchange-format-for-ai/)
5354
- [Safetensors](https://github.com/huggingface/safetensors) weight loading
5455
- Watermarking with [A Watermark for Large Language Models](https://arxiv.org/abs/2301.10226)
5556
- Logits warper (temperature scaling, top-p, top-k, repetition penalty, more details see [transformers.LogitsProcessor](https://huggingface.co/docs/transformers/internal/generation_utils#transformers.LogitsProcessor))
@@ -94,6 +95,29 @@ curl 127.0.0.1:8080/generate_stream \
9495
-H 'Content-Type: application/json'
9596
```
9697

98+
You can also use [TGI's Messages API](https://huggingface.co/docs/text-generation-inference/en/messages_api) to obtain Open AI Chat Completion API compatible responses.
99+
100+
```bash
101+
curl localhost:3000/v1/chat/completions \
102+
-X POST \
103+
-d '{
104+
"model": "tgi",
105+
"messages": [
106+
{
107+
"role": "system",
108+
"content": "You are a helpful assistant."
109+
},
110+
{
111+
"role": "user",
112+
"content": "What is deep learning?"
113+
}
114+
],
115+
"stream": true,
116+
"max_tokens": 20
117+
}' \
118+
-H 'Content-Type: application/json'
119+
```
120+
97121
**Note:** To use NVIDIA GPUs, you need to install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html). 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.
98122

99123
**Note:** TGI supports AMD Instinct MI210 and MI250 GPUs. Details can be found in the [Supported Hardware documentation](https://huggingface.co/docs/text-generation-inference/supported_models#supported-hardware). 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:2.2.0-rocm --model-id $model` instead of the command above.
@@ -122,7 +146,7 @@ For example, if you want to serve the gated Llama V2 model variants:
122146
or with Docker:
123147

124148
```shell
125-
model=meta-llama/Llama-2-7b-chat-hf
149+
model=meta-llama/Meta-Llama-3.1-8B-Instruct
126150
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
127151
token=<your cli READ token>
128152

@@ -234,14 +258,16 @@ text-generation-launcher --model-id mistralai/Mistral-7B-Instruct-v0.2
234258

235259
### Quantization
236260

237-
You can also quantize the weights with bitsandbytes to reduce the VRAM requirement:
261+
You can also run pre-quantized weights (AWQ, GPTQ, Marlin) or on-the-fly quantize weights with bitsandbytes, EETQ, fp8, to reduce the VRAM requirement:
238262

239263
```shell
240264
text-generation-launcher --model-id mistralai/Mistral-7B-Instruct-v0.2 --quantize
241265
```
242266

243267
4bit quantization is available using the [NF4 and FP4 data types from bitsandbytes](https://arxiv.org/pdf/2305.14314.pdf). It can be enabled by providing `--quantize bitsandbytes-nf4` or `--quantize bitsandbytes-fp4` as a command line argument to `text-generation-launcher`.
244268

269+
Read more about quantization in the [Quantization documentation](https://huggingface.co/docs/text-generation-inference/en/conceptual/quantization).
270+
245271
## Develop
246272

247273
```shell

docs/source/conceptual/quantization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ We recommend using the official quantization scripts for creating your quants:
1111

1212
For on-the-fly quantization you simply need to pass one of the supported quantization types and TGI takes care of the rest.
1313

14-
## Quantization with bitsandbytes
14+
## Quantization with bitsandbytes, EETQ & fp8
1515

1616
bitsandbytes is a library used to apply 8-bit and 4-bit quantization to models. Unlike GPTQ quantization, bitsandbytes doesn't require a calibration dataset or any post-processing – weights are automatically quantized on load. However, inference with bitsandbytes is slower than GPTQ or FP16 precision.
1717

@@ -32,7 +32,7 @@ docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingf
3232

3333
You can get more information about 8-bit quantization by reading this [blog post](https://huggingface.co/blog/hf-bitsandbytes-integration), and 4-bit quantization by reading [this blog post](https://huggingface.co/blog/4bit-transformers-bitsandbytes).
3434

35-
Use `eetq` or `fp8` for other quantization schemes.
35+
Similarly you can use pass you can pass `--quantize eetq` or `--quantize fp8` for respective quantization schemes.
3636

3737
In addition to this, TGI allows creating GPTQ quants directly by passing the model weights and a calibration dataset.
3838

docs/source/quicktour.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ TGI supports various hardware. Make sure to check the [Using TGI with Nvidia GPU
2121

2222
## Consuming TGI
2323

24-
Once TGI is running, you can use the `generate` endpoint by doing requests. To learn more about how to query the endpoints, check the [Consuming TGI](./basic_tutorials/consuming_tgi) section, where we show examples with utility libraries and UIs. Below you can see a simple snippet to query the endpoint.
24+
Once TGI is running, you can use the `generate` endpoint or the Open AI Chat Completion API compatible [Messages API](https://huggingface.co/docs/text-generation-inference/en/messages_api) by doing requests. To learn more about how to query the endpoints, check the [Consuming TGI](./basic_tutorials/consuming_tgi) section, where we show examples with utility libraries and UIs. Below you can see a simple snippet to query the endpoint.
2525

2626
<inferencesnippet>
2727
<python>

0 commit comments

Comments
 (0)