Skip to main content
In this guide, we will deploy a Llama based LLM using Nvidia’s TensorRT-LLM runtime. Specfically for this example we will deploy meta-llama/Llama-3.1-8B-Instruct with bf16 precision on 2 x L40S GPUs but you can choose whatever GPU configuration available to you

Quantization Support coming soon!

1. Add your Huggingface Token as a Secret

Since we are going to deploy the official Llama 3.1 8B Instruct model, we’d need a Huggingface Token that has access to the model. Visit the model page and fill the access form. You’d get access to the model in 10-15 mins.
Now, Create a token following the HuggingFace Docs and Add it as a secret which we can use later

2. Create a ML Repo and a Workspace with access to ML Repo

Follow the docs at Creating a ML Repo to create a ML Repo backed by your Storage Integration. We will use this to store and version TRT-LLM engines.
Create a Workspace or use and existing Workspace and Grant it Editor access to the ML Repo

3. Deploy the Engine Builder Job

  1. Save the following YAML in a file called builder.truefoundry.yaml

resources section varies across cloud provider

Based on your cloud provider, the available gpu type and nodepools will be different, you’d need to adjust it before deploying.
  1. Replace YOUR-HF-TOKEN-SECRET-FQN with the Secret FQN we created at the beginning. E.g.
  1. Generating correct resources section your configuration.
Start a New Deployment, scroll to Resources section and select the GPU type and Count and click on the Spec button
You can copy this resources section and replace it in builder.truefoundry.yaml
  1. After Setting up CLI, deploy the job by mentioning the Workspace FQN
  1. Once the Job is deployed, Trigger it
Enter a Run Name. You can modify other arguments if needed. Please refer to TRT-LLM Docs to know more about these parameters. Click Submit
  1. When the run finishes, you’d have the tokenizer and engine ready to use under the Run Details section
Engine is available under Models section. Copy the FQN and keep it handy.
Tokenizer is available under Artifacts section. Copy the FQN and keep it handy.

4. Deploy with Nvidia Triton Server

Finally, let’s deploy the engine using Nvidia Triton Server as a TrueFoundry Service. Here is the spec in full:

resources section varies across cloud provider

Based on your cloud provider, the available gpu type and nodepools will be different, you’d need to adjust it before deploying.
  1. Adjust the resources section like we did for the builder Job

GPU configuration must be same as the Builder Job

Since TRT-LLM optimizes the model for the target GPU type and counts - it is important that the GPU type and count matches while deploying.
  1. In artifacts_download, you’d need to change artifact_version_fqn to the tokenizer and engine obtained at the end of the Job Run from previous section
  2. Deploy the Service by mentioning the Workspace FQN
  1. Once deployed, we’ll make some final adjustments by editing the Service
    • From Ports section Enable Expose and configure Endpoint as needed

5. Run Inferences

You can now send a payload like follows to /v1/chat/completions Endpoint via the OpenAPI tab
Since the endpoint is OpenAI compatible, you can Add it to AI Gateway or use it directly with OpenAI SDK