mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-26 12:32:10 +00:00
Enhancements to README (#226)
This commit is contained in:
parent
e424752fa3
commit
fe8a373831
50
README.md
50
README.md
@ -40,36 +40,52 @@ To use [🤗 text-generation-inference](https://github.com/huggingface/text-gene
|
||||
> ```bash
|
||||
> docker build -t tgi_gaudi .
|
||||
> ```
|
||||
2. Launch a local server instance:
|
||||
2. Use one of the following snippets to launch a local server instance:
|
||||
> [!NOTE]
|
||||
> For gated models such as [meta-llama/Llama-2-7b-hf](https://huggingface.co/meta-llama/Llama-2-7b-hf), you will have to pass `-e HF_TOKEN=<token>` to the `docker run` commands below with a valid Hugging Face Hub read token.
|
||||
|
||||
i. On 1 Gaudi card
|
||||
i. On 1 Gaudi card
|
||||
```bash
|
||||
model=meta-llama/Llama-2-7b-hf
|
||||
hf_token=YOUR_ACCESS_TOKEN
|
||||
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
|
||||
|
||||
docker run -p 8080:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e HUGGING_FACE_HUB_TOKEN=$hf_token -e ENABLE_HPU_GRAPH=true -e LIMIT_HPU_GRAPH=true -e USE_FLASH_ATTENTION=true -e FLASH_ATTENTION_RECOMPUTE=true --cap-add=sys_nice --ipc=host ghcr.io/huggingface/tgi-gaudi:2.0.5 --model-id $model --max-input-tokens 1024 --max-total-tokens 2048
|
||||
docker run -p 8080:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none -e HF_TOKEN=$hf_token \
|
||||
-e ENABLE_HPU_GRAPH=true -e LIMIT_HPU_GRAPH=true -e USE_FLASH_ATTENTION=true \
|
||||
-e FLASH_ATTENTION_RECOMPUTE=true --cap-add=sys_nice --ipc=host \
|
||||
ghcr.io/huggingface/tgi-gaudi:2.0.5 --model-id $model --max-input-tokens 1024 \
|
||||
--max-total-tokens 2048
|
||||
```
|
||||
> For gated models such as [StarCoder](https://huggingface.co/bigcode/starcoder), you will have to pass `-e HUGGING_FACE_HUB_TOKEN=<token>` to the `docker run` command above with a valid Hugging Face Hub read token.
|
||||
|
||||
ii. On 1 Gaudi card using PyTorch eager mode with torch compile:
|
||||
ii. On 1 Gaudi card using PyTorch eager mode with torch compile:
|
||||
```bash
|
||||
model=meta-llama/Llama-2-7b-hf
|
||||
hf_token=YOUR_ACCESS_TOKEN
|
||||
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
|
||||
|
||||
docker run -p 8080:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e PT_HPU_LAZY_MODE=0 -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e HUGGING_FACE_HUB_TOKEN=$hf_token --cap-add=sys_nice --ipc=host ghcr.io/huggingface/tgi-gaudi:2.0.5 --model-id $model --max-input-tokens 1024 --max-total-tokens 2048
|
||||
docker run -p 8080:80 -v $volume:/data --runtime=habana -e HABANA_VISIBLE_DEVICES=all \
|
||||
-e PT_HPU_LAZY_MODE=0 -e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e HF_TOKEN=$hf_token --cap-add=sys_nice --ipc=host \
|
||||
ghcr.io/huggingface/tgi-gaudi:2.0.5 --model-id $model --max-input-tokens 1024 --max-total-tokens 2048
|
||||
```
|
||||
|
||||
iii. On 8 Gaudi cards:
|
||||
iii. On 8 Gaudi cards:
|
||||
```bash
|
||||
model=meta-llama/Llama-2-70b-hf
|
||||
hf_token=YOUR_ACCESS_TOKEN
|
||||
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
|
||||
|
||||
docker run -p 8080:80 -v $volume:/data --runtime=habana -e PT_HPU_ENABLE_LAZY_COLLECTIVES=true -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none -e HUGGING_FACE_HUB_TOKEN=$hf_token -e ENABLE_HPU_GRAPH=true -e LIMIT_HPU_GRAPH=true -e USE_FLASH_ATTENTION=true -e FLASH_ATTENTION_RECOMPUTE=true --cap-add=sys_nice --ipc=host ghcr.io/huggingface/tgi-gaudi:2.0.5 --model-id $model --sharded true --num-shard 8 --max-input-tokens 1024 --max-total-tokens 2048
|
||||
docker run -p 8080:80 -v $volume:/data --runtime=habana -e PT_HPU_ENABLE_LAZY_COLLECTIVES=true \
|
||||
-e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e HF_TOKEN=$hf_token -e ENABLE_HPU_GRAPH=true -e LIMIT_HPU_GRAPH=true \
|
||||
-e USE_FLASH_ATTENTION=true -e FLASH_ATTENTION_RECOMPUTE=true --cap-add=sys_nice \
|
||||
--ipc=host ghcr.io/huggingface/tgi-gaudi:2.0.5 --model-id $model --sharded true \
|
||||
--num-shard 8 --max-input-tokens 1024 --max-total-tokens 2048
|
||||
```
|
||||
3. You can then send a simple request:
|
||||
3. Wait for the TGI-Gaudi server to come online. You will see something like so:
|
||||
> 2024-05-22T19:31:48.302239Z INFO text_generation_router: router/src/main.rs:378: Connected
|
||||
You can then send a simple request to the server from a separate terminal:
|
||||
```bash
|
||||
curl 127.0.0.1:8080/generate \
|
||||
-X POST \
|
||||
@ -124,7 +140,7 @@ docker run -p 8080:80 \
|
||||
--runtime=habana \
|
||||
-v $volume:/data \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e MAX_TOTAL_TOKENS=2048 \
|
||||
@ -155,7 +171,7 @@ docker run -p 8080:80 \
|
||||
--runtime=habana \
|
||||
-v $volume:/data \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e PT_HPU_ENABLE_LAZY_COLLECTIVES=true \
|
||||
@ -188,7 +204,7 @@ docker run -p 8080:80 \
|
||||
--runtime=habana \
|
||||
-v $volume:/data \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e MAX_TOTAL_TOKENS=2048 \
|
||||
@ -219,7 +235,7 @@ docker run -p 8080:80 \
|
||||
--runtime=habana \
|
||||
-v $volume:/data \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e PT_HPU_ENABLE_LAZY_COLLECTIVES=true \
|
||||
@ -303,7 +319,7 @@ docker run -p 8080:80 \
|
||||
-v $PWD/hqt_output:/usr/src/hqt_output \
|
||||
-e QUANT_CONFIG=./quantization_config/maxabs_quant.json \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e MAX_TOTAL_TOKENS=2048 \
|
||||
@ -337,7 +353,7 @@ docker run -p 8080:80 \
|
||||
-v $PWD/hqt_output:/usr/src/hqt_output \
|
||||
-e QUANT_CONFIG=./quantization_config/maxabs_quant.json \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e PT_HPU_ENABLE_LAZY_COLLECTIVES=true \
|
||||
@ -374,7 +390,7 @@ docker run -p 8080:80 \
|
||||
-v $PWD/hqt_output:/usr/src/hqt_output \
|
||||
-e QUANT_CONFIG=./quantization_config/maxabs_quant.json \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e MAX_TOTAL_TOKENS=2048 \
|
||||
@ -408,7 +424,7 @@ docker run -p 8080:80 \
|
||||
-v $PWD/hqt_output:/usr/src/hqt_output \
|
||||
-e QUANT_CONFIG=./quantization_config/maxabs_quant.json \
|
||||
-e HABANA_VISIBLE_DEVICES=all \
|
||||
-e HUGGING_FACE_HUB_TOKEN=$hf_token \
|
||||
-e HF_TOKEN=$hf_token \
|
||||
-e OMPI_MCA_btl_vader_single_copy_mechanism=none \
|
||||
-e TEXT_GENERATION_SERVER_IGNORE_EOS_TOKEN=true \
|
||||
-e PT_HPU_ENABLE_LAZY_COLLECTIVES=true \
|
||||
|
Loading…
Reference in New Issue
Block a user