Add examples/gke/tgi-tpu-deployment/ for TGI on TPU#62
Draft
alvarobartt wants to merge 7 commits intomainfrom
Draft
Add examples/gke/tgi-tpu-deployment/ for TGI on TPU#62alvarobartt wants to merge 7 commits intomainfrom
examples/gke/tgi-tpu-deployment/ for TGI on TPU#62alvarobartt wants to merge 7 commits intomainfrom
Conversation
Since `MAX_BATCH_PREFILL_TOKENS` is internally set by Text Generation Inference (TGI) to `MAX_INPUT_TOKENS + 50`, and as the TGI on TPU model warm-up validates that `MAX_BATCH_PREFILL_TOKENS <= MAX_INPUT_TOKENS * BATCH_SIZE`, then we set the `BATCH_SIZE=2` so that `MAX_INPUT_TOKENS + 50 < MAX_INPUT_TOKENS * 2` so that the validation passes. Alternatively, one could also set the `MAX_BATCH_PREFILL_TOKENS` to a value lower or equal than `MAX_INPUT_TOKENS` (ideally equal).
philschmid
approved these changes
Jul 30, 2024
tengomucho
approved these changes
Jul 30, 2024
| > Installing the `gke-gcloud-auth-plugin` does not need to be installed via `gcloud` specifically, to read more about the alternative installation methods, please visit [Install `kubectl` and configure cluster access](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl). | ||
|
|
||
| Finally, we also need to ensure that we have enough quota or capacity to create the GKE Cluster with the necessary resources, which can be checked in the GCP Console at <https://console.cloud.google.com/iam-admin/quotas>. In this case, in order to use the TPU v5e we need to check the quota with the following filter `Service: Compute Engine API`, `Type: Quota`, and `Name: TPU v5 Lite PodSlice chips`; and then ensure that we have enough capacity in the selected location by just taking into consideration that the topologies as e.g. `2x4` mean that we need `8` chips available. | ||
|
|
Collaborator
There was a problem hiding this comment.
consider mentioning that for now the largest supported configuration is 2x4. Larger multi-host environment are not yet supported by TGI (soon).
Member
Author
There was a problem hiding this comment.
Fair thanks, I'll include this!
| ```bash | ||
| ChatCompletion(id='', choices=[Choice(finish_reason='eos_token', index=0, message=ChatCompletionMessage(content='Sure, the answer is 4.\n\n2 + 2 = 4<eos>', role='assistant', function_call=None, tool_calls=None), logprobs=None)], created=1722329005, model='google/gemma-7b-it', object='text_completion', system_fingerprint='2.0.2-native', usage=CompletionUsage(completion_tokens=17, prompt_tokens=0, total_tokens=17)) | ||
| ``` | ||
|
|
Collaborator
There was a problem hiding this comment.
I don't know if it's worth mentioning it, but it is possible just to use the standard python lib to do the request.
Member
Author
There was a problem hiding this comment.
Standard as in via requests or via huggingface_hub.InferenceClient? Or none of those?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds an example on how to use the recently created TGI container for TPU inference on #57 in Google Kubernetes Engine (GKE) using TPU v5e chips. In this case, the model served is
google/gemma-7b-itwhich is among the supported models withinoptimum-tpu.For more information on
optimum-tpuplease check https://github.com/huggingface/optimum-tpuWhat's missing?
We still need to ping Google Cloud about the recent release of the TPU container as well as waiting for it to be released, and then just update the
CONTAINER_URIaccordingly.