Skip to content
Open
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
9 changes: 9 additions & 0 deletions truss/base/trt_llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,15 @@ def trt_llm_common_validation(config: "TrussConfig"):
from truss.base import truss_config

assert config.trt_llm, "TRT-LLM configuration is required for TRT-LLM models"
default_python_version = truss_config.TrussConfig.model_fields[
"python_version"
].default
if config.python_version != default_python_version:
logger.warning(
f"`python_version: {config.python_version}` has no effect on TRT-LLM models: "
"the TRT-LLM base image ships its own fixed Python interpreter, independent of "
"this setting."
)
trt_llm_config: TRTLLMConfigurationV1 | TRTLLMConfigurationV2 = config.trt_llm.root
base_model = (
trt_llm_config.build.base_model
Expand Down
28 changes: 28 additions & 0 deletions truss/tests/trt_llm/test_trt_llm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
TrussTRTLLMBuildConfiguration,
TrussTRTLLMRuntimeConfiguration,
)
from truss.base.truss_config import TrussConfig


def test_trt_llm_config_init_from_pydantic_models(trtllm_config):
Expand Down Expand Up @@ -246,3 +247,30 @@ def test_trt_llm_config_additional_fields(trtllm_config_v2):

assert config.inference_stack == "v2"
assert isinstance(config.build, TrussTRTLLMBuildConfiguration)


def test_trt_llm_non_default_python_version_warns(trtllm_config, caplog):
"""python_version has no effect on TRT-LLM models: the TRT-LLM base image ships
its own fixed Python interpreter. Setting a non-default value should warn."""
trtllm_config["python_version"] = "py311"

with caplog.at_level("WARNING"):
TrussConfig.from_dict(trtllm_config)

assert "has no effect on TRT-LLM models" in caplog.text


def test_trt_llm_default_python_version_no_warning(trtllm_config, caplog):
with caplog.at_level("WARNING"):
TrussConfig.from_dict(trtllm_config)

assert "has no effect on TRT-LLM models" not in caplog.text


def test_trt_llm_v2_non_default_python_version_warns(trtllm_config_v2, caplog):
trtllm_config_v2["python_version"] = "py311"

with caplog.at_level("WARNING"):
TrussConfig.from_dict(trtllm_config_v2)

assert "has no effect on TRT-LLM models" in caplog.text