Views
No views yet

1model=HuggingFaceH4/zephyr-7b-beta
2volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
3
4docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $model1curl 127.0.0.1:8080/generate_stream \
2 -X POST \
3 -d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":20}}' \
4 -H 'Content-Type: application/json'--gpus all flag and add --disable-custom-kernels, please note CPU is not the intended platform for this project, so performance might be subpar.docker run --device /dev/kfd --device /dev/dri --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0-rocm --model-id $model instead of the command above.text-generation-launcher --helptext-generation-inference REST API using the /docs route.
The Swagger UI is also available at: https://huggingface.github.io/text-generation-inference.HUGGING_FACE_HUB_TOKEN environment variable for configuring the token employed by
text-generation-inference. This allows you to gain access to protected resources.HUGGING_FACE_HUB_TOKEN=<your cli READ token>1model=meta-llama/Llama-2-7b-chat-hf
2volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
3token=<your cli READ token>
4
5docker run --gpus all --shm-size 1g -e HUGGING_FACE_HUB_TOKEN=$token -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.0 --model-id $modelNCCL is a communication framework used by
PyTorch to do distributed training/inference. text-generation-inference make
use of NCCL to enable Tensor Parallelism to dramatically speed up inference for large language models.NCCL group, NCCL might fall back to using the host memory if
peer-to-peer using NVLink or PCI is not possible.--shm-size 1g on the above command.text-generation-inference inside Kubernetes. You can also add Shared Memory to the container by
creating a volume with:1- name: shm
2 emptyDir:
3 medium: Memory
4 sizeLimit: 1Gi/dev/shm.NCCL_SHM_DISABLE=1 environment variable. However, note that
this will impact performance.text-generation-inference is instrumented with distributed tracing using OpenTelemetry. You can use this feature
by setting the address to an OTLP collector with the --otlp-endpoint argument.
text-generation-inference locally.conda:1curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2
3conda create -n text-generation-inference python=3.11
4conda activate text-generation-inference1PROTOC_ZIP=protoc-21.12-linux-x86_64.zip
2curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP
3sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
4sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
5rm -f $PROTOC_ZIPbrew install protobuf1BUILD_EXTENSIONS=True make install # Install repository and HF/transformer fork with CUDA kernels
2text-generation-launcher --model-id mistralai/Mistral-7B-Instruct-v0.2sudo apt-get install libssl-dev gcc -yAutoModelForCausalLM.from_pretrained(<model>, device_map="auto")AutoModelForSeq2SeqLM.from_pretrained(<model>, device_map="auto")text-generation-launcher --model-id mistralai/Mistral-7B-Instruct-v0.2text-generation-launcher --model-id mistralai/Mistral-7B-Instruct-v0.2 --quantize--quantize bitsandbytes-nf4 or --quantize bitsandbytes-fp4 as a command line argument to text-generation-launcher.1make server-dev
2make router-dev1# python
2make python-server-tests
3make python-client-tests
4# or both server and client tests
5make python-tests
6# rust cargo tests
7make rust-tests
8# integration tests
9make integration-tests