Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/config-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ engine:
served_model_name: "Qwen/Qwen3-0.6B"
```

For `trtllm_serve`, an explicit `served_model_name` is passed to the worker's
`--served_model_name` option so the server and benchmark/eval clients use the same
API model name. Leave it unset to retain the server's default. This is a server
option, not a key in `roles.*.args` (the engine YAML).

```yaml
engine:
type: mocker
Expand Down
1 change: 1 addition & 0 deletions examples/trtllm/trtllm-serve-agg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ frontend:

engine:
type: trtllm
# API model name shared by the server and benchmark/eval clients.
served_model_name: "Qwen/Qwen3-0.6B"
roles:
agg:
Expand Down
2 changes: 2 additions & 0 deletions src/srtctl/backends/trtllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ def build_worker_command(
# ai-dynamo tensorrtllm-runtime 1.3.0-dev.1 container, which accept --config;
# some trtllm-serve builds spell this --extra_llm_api_options.
cmd.extend(["--config", str(container_config_path)])
if self.served_model_name:
cmd.extend(["--served_model_name", self.served_model_name])
cmd.extend(self.get_extra_args_for_mode(mode))
return self._wrap_with_numa_cpu_bind(cmd)

Expand Down
37 changes: 34 additions & 3 deletions tests/test_trtllm_served_model_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@

"""Tests for TRT-LLM's served model name override."""

from pathlib import Path
from types import SimpleNamespace
from unittest.mock import MagicMock

import pytest

from srtctl.backends.trtllm import TRTLLMProtocol, TRTLLMServerConfig
from srtctl.core.schema import DynamoConfig
from srtctl.core.topology import Process


class TestTRTLLMServedModelName:
Expand Down Expand Up @@ -39,9 +47,6 @@ def test_is_not_written_into_the_engine_yaml(self):

def test_reaches_the_worker_command(self):
"""The worker must actually be launched with the configured name."""
from pathlib import Path
from unittest.mock import MagicMock

backend = TRTLLMProtocol(served_model_name="deepseek-ai/deepseek-r1")
runtime = MagicMock()
runtime.model_path = Path("/models/deepseek_r1-torch-fp4-v2")
Expand All @@ -53,3 +58,29 @@ def test_reaches_the_worker_command(self):

assert "--served-model-name" in cmd
assert cmd[cmd.index("--served-model-name") + 1] == "deepseek-ai/deepseek-r1"

@pytest.mark.parametrize("name", ["org/model", None])
def test_direct_worker_receives_explicit_name(self, tmp_path: Path, name: str | None) -> None:
backend = TRTLLMProtocol(served_model_name=name)
runtime = SimpleNamespace(
model_path=Path("/weights/checkpoint"),
worker_model_arg="/model",
log_dir=tmp_path,
gpu_type="h200",
frontend_port=8000,
dynamo=DynamoConfig(),
)
process = Process(
node="worker",
gpu_indices=frozenset({0}),
sys_port=7500,
http_port=9001,
endpoint_mode="agg",
endpoint_index=0,
)
command = backend.build_worker_command(process, [process], runtime, frontend_type="trtllm_serve")

if name is None:
assert "--served_model_name" not in command
else:
assert command[command.index("--served_model_name") + 1] == "org/model"
Loading