Helm chartv1.1.1App 2.4.1Verified publisher

The Helm chart for HuggingFace Text Generation Inference Server

About this chart

tgi

Helm chart for deploying Hugging Face Text Generation Inference service.

Installing the Chart

To install the chart, run the following:

cd GenAIInfra/helm-charts/common
export MODELDIR=/mnt/opea-models
export MODELNAME="bigscience/bloom-560m"
export HFTOKEN="insert-your-huggingface-token-here"
helm install tgi tgi --set global.modelUseHostPath=${MODELDIR} --set LLM_MODEL_ID=${MODELNAME} --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN}
# To deploy on Gaudi enabled kubernetes cluster
# helm install tgi tgi --set global.modelUseHostPath=${MODELDIR} --set LLM_MODEL_ID=${MODELNAME} --set global.HUGGINGFACEHUB_API_TOKEN=${HFTOKEN} --values gaudi-values.yaml

By default, the tgi service will downloading the "bigscience/bloom-560m" which is about 1.1GB.

If you already cached the model locally, you can pass it to container like this example:

MODELDIR=/mnt/opea-models

MODELNAME="/data/models--bigscience--bloom-560m"

Verify

To verify the installation, run the command kubectl get pod to make sure all pods are runinng.

Then run the command kubectl port-forward svc/tgi 2080:80 to expose the tgi service for access.

Open another terminal and run the following command to verify the service if working:

curl http://localhost:2080/generate \
    -X POST \
    -d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \
    -H 'Content-Type: application/json'

Values

KeyTypeDefaultDescription
LLM_MODEL_IDstring"bigscience/bloom-560m"Models id from https://huggingface.co/, or predownloaded model directory
global.HUGGINGFACEHUB_API_TOKENstringinsert-your-huggingface-token-hereHugging Face API token
global.modelUseHostPathstring"/mnt/opea-models"Cached models directory, tgi will not download if the model is cached here. The host path "modelUseHostPath" will be mounted to container as /data directory. Set this to null/empty will force it to download model.
image.repositorystring"ghcr.io/huggingface/text-generation-inference"
image.tagstring"1.4"
horizontalPodAutoscaler.enabledboolfalseEnable HPA autoscaling for the service deployment based on metrics it provides. See HPA section in ../../README.md before enabling!

Deploy opea-tgi with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has opea-tgi on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartopea-tgi is pinned at v1.1.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply