|
| 1 | +--- |
| 2 | +title: 'Deploying TensorRT-LLM' |
| 3 | +description: 'Deploy TensorRT-LLM images on CCluster through General Inference' |
| 4 | +icon: 'gauge' |
| 5 | +--- |
| 6 | + |
| 7 | +[NVIDIA TensorRT-LLM](https://github.com/NVIDIA/TensorRT-LLM) images run through [General Inference](/apps/inference) and expose an OpenAI-compatible API with `trtllm-serve`. This example walks through deploying `TinyLlama/TinyLlama-1.1B-Chat-v1.0` with a validated release image. |
| 8 | + |
| 9 | +## Before you begin |
| 10 | + |
| 11 | +Prepare the following: |
| 12 | + |
| 13 | +- Access to a cluster with a suitable NVIDIA GPU hardware instance |
| 14 | +- A Hugging Face token if the model is gated or you need higher Hub rate limits |
| 15 | +- A Bearer token or client certificate for endpoint authentication |
| 16 | + |
| 17 | +The image and model versions must be compatible. Review the [TensorRT-LLM support matrix](https://nvidia.github.io/TensorRT-LLM/reference/support-matrix.html) before using a different model or image tag. |
| 18 | + |
| 19 | +## Configure the deployment |
| 20 | + |
| 21 | +From **Create deployment**, select **Inference**, then configure the container: |
| 22 | + |
| 23 | +| Field | Example value | |
| 24 | +|---|---| |
| 25 | +| **Add or Select Image** | `nvcr.io/nvidia/tensorrt-llm/release` | |
| 26 | +| **Container Tag** | `1.3.0rc22` | |
| 27 | +| **Container Port** | `8000` | |
| 28 | +| **Protocol** | `HTTP` | |
| 29 | +| **Health check path** | `/health` | |
| 30 | + |
| 31 | +The image might appear as `nvidia/tensorrt-llm/release` in the prebuilt image list. The tag above is a validated example; use a tag that supports your selected model. |
| 32 | + |
| 33 | +### Add command |
| 34 | + |
| 35 | +The TensorRT-LLM release image does not start an inference server by itself. Under **Optional Details → Add command**, enter: |
| 36 | + |
| 37 | +```bash |
| 38 | +/bin/bash -lc 'trtllm-serve TinyLlama/TinyLlama-1.1B-Chat-v1.0 --host 0.0.0.0 --port 8000 --config /etc/engine/config.yaml' |
| 39 | +``` |
| 40 | + |
| 41 | +Replace the model identifier with the Hugging Face model or TensorRT-LLM engine path you want to serve. Wrap the full `trtllm-serve` command in `/bin/bash -lc '...'` so the image shell initializes the TensorRT-LLM environment before the server starts. |
| 42 | + |
| 43 | +| Argument | Why it matters | |
| 44 | +|---|---| |
| 45 | +| `/bin/bash -lc '...'` | Loads the image environment before running `trtllm-serve` | |
| 46 | +| `trtllm-serve <model>` | Starts the OpenAI-compatible server | |
| 47 | +| `--host 0.0.0.0` | Required so CCluster can reach the server | |
| 48 | +| `--port 8000` | Must match **Container Port** | |
| 49 | +| `--config /etc/engine/config.yaml` | Points at the mounted config file | |
| 50 | + |
| 51 | +### Config file |
| 52 | + |
| 53 | +Add a config file with these settings: |
| 54 | + |
| 55 | +| Field | Value | |
| 56 | +|---|---| |
| 57 | +| **Filename** | `config.yaml` | |
| 58 | +| **Mount path** | `/etc/engine` | |
| 59 | + |
| 60 | +Use the directory as the mount path, not the full filename. CCluster mounts the file at `/etc/engine/config.yaml`. |
| 61 | + |
| 62 | +For the TinyLlama example, use: |
| 63 | + |
| 64 | +```yaml |
| 65 | +model: TinyLlama/TinyLlama-1.1B-Chat-v1.0 |
| 66 | +max_batch_size: 8 |
| 67 | +max_num_tokens: 2048 |
| 68 | +max_seq_len: 2048 |
| 69 | +trust_remote_code: true |
| 70 | + |
| 71 | +kv_cache_config: |
| 72 | + free_gpu_memory_fraction: 0.8 |
| 73 | + enable_block_reuse: true |
| 74 | + |
| 75 | +enable_iter_perf_stats: true |
| 76 | +``` |
| 77 | +
|
| 78 | +Tune `max_batch_size`, `max_seq_len`, and `free_gpu_memory_fraction` for your model and GPU memory. For TensorRT-LLM 1.3.x, keep these options at the top level; do not wrap them in `pytorch_backend_config`. |
| 79 | + |
| 80 | +### Model credentials |
| 81 | + |
| 82 | +Under **Optional Details → Environment Variables**, set `HF_TOKEN` to a Hugging Face token when the model is gated or private. You can store the token in a [Vault object](/resources/vault) instead of entering it directly. |
| 83 | + |
| 84 | +Every endpoint must also be protected with a Bearer token, an mTLS client certificate, or both. See [Securing Endpoints](/resources/private). |
| 85 | + |
| 86 | +From here the deployment follows the standard General Inference flow — select the cluster and hardware, click **Deploy**, and wait until the deployment is ready. Model download and GPU initialization can take several minutes. See [General Inference](/apps/inference) for details. |
| 87 | + |
| 88 | +## Test the endpoint |
| 89 | + |
| 90 | +Copy the endpoint URL and Bearer token from the deployment detail page: |
| 91 | + |
| 92 | +```bash |
| 93 | +export ENDPOINT='https://<endpoint_url>' |
| 94 | +export CCLUSTER_TOKEN='<your_bearer_token>' |
| 95 | +
|
| 96 | +# Check readiness |
| 97 | +curl -sS -o /dev/null -w "%{http_code}\n" \ |
| 98 | + -H "Authorization: Bearer $CCLUSTER_TOKEN" \ |
| 99 | + "$ENDPOINT/health" |
| 100 | +
|
| 101 | +# Find the served model identifier |
| 102 | +curl -sS \ |
| 103 | + -H "Authorization: Bearer $CCLUSTER_TOKEN" \ |
| 104 | + "$ENDPOINT/v1/models" |
| 105 | +
|
| 106 | +# Send a chat completion request |
| 107 | +curl -sS "$ENDPOINT/v1/chat/completions" \ |
| 108 | + -H "Authorization: Bearer $CCLUSTER_TOKEN" \ |
| 109 | + -H "Content-Type: application/json" \ |
| 110 | + -d '{ |
| 111 | + "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", |
| 112 | + "messages": [{"role": "user", "content": "Say hello."}], |
| 113 | + "max_tokens": 64 |
| 114 | + }' |
| 115 | +``` |
| 116 | + |
| 117 | +Use the exact model `id` returned by `/v1/models` in subsequent requests. The first request can take longer while the runtime finishes warming up. |
| 118 | + |
| 119 | +## Troubleshooting |
| 120 | + |
| 121 | +| Symptom | Resolution | |
| 122 | +|---|---| |
| 123 | +| Deployment does not become ready although the server started | Confirm the command includes `--host 0.0.0.0`. | |
| 124 | +| Logs report `Is a directory: '.../config.yaml'` | Set **Mount path** to `/etc/engine` and **Filename** to `config.yaml`. | |
| 125 | +| Logs report unsupported `pytorch_backend_config` arguments | Remove that block and place supported options at the top level of the YAML file. | |
| 126 | +| API returns `401` | Send the deployment's Bearer token in the `Authorization` header. | |
| 127 | +| API returns `503` or `no healthy upstream` | Wait for the deployment to become ready, then check the host and config mount settings. | |
| 128 | +| Model download is slow or fails | Set `HF_TOKEN` and confirm that it can access the model. | |
| 129 | + |
| 130 | +## What's next |
| 131 | + |
| 132 | +<CardGroup cols={3}> |
| 133 | + <Card |
| 134 | + title="General Inference" |
| 135 | + icon="circle-nodes" |
| 136 | + href="/apps/inference" |
| 137 | + > |
| 138 | + Deploy and scale any containerized model on CCluster. |
| 139 | + </Card> |
| 140 | + <Card |
| 141 | + title="Securing Endpoints" |
| 142 | + icon="lock" |
| 143 | + href="/resources/private" |
| 144 | + > |
| 145 | + Protect your endpoints with Bearer tokens and mTLS certificates. |
| 146 | + </Card> |
| 147 | + <Card |
| 148 | + title="Managing Vault Objects" |
| 149 | + icon="key-skeleton-left-right" |
| 150 | + href="/resources/vault" |
| 151 | + > |
| 152 | + Store the registry credentials and API keys your deployments use. |
| 153 | + </Card> |
| 154 | +</CardGroup> |
0 commit comments