fix(trt_llm): warn when python_version is ignored - #2598
Open
blockgroot wants to merge 1 commit into
Open
Conversation
TRT-LLM base images ship their own fixed Python interpreter, and docker_build_setup.py overrides config.base_image + python_executable_path unconditionally for every TRT-LLM v1 and v2 model. As a result, python_version was accepted and validated but had no effect on TRT-LLM deployments, with nothing surfacing that to the user. Warn in trt_llm_common_validation() when python_version differs from its default alongside a TRT-LLM config, matching the existing warning idiom in the same function. This is additive only: the override behavior is unchanged, existing configs just get visibility into it. Fixes basetenlabs#2168
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.
🚀 What
Adds a warning when
python_versionis set on a TRT-LLM model, since it currently has no effect there.Fixes #2168
Problem: for any TRT-LLM model (decoder/Briton, encoder/BEI, encoder-bert, or v2),
_fill_trt_llm_versions(truss/contexts/docker_build_setup.py:34-84) forcesconfig.base_image+ a fixedpython_executable_path—/usr/local/briton/venv/bin/pythonfor decoder,/usr/bin/python3for the others. Onceconfig.base_imageis set this way,serving_image_builder.py:970-975skips thepython_version-derived image tag entirely, andserver.Dockerfile.jinja:32-34symlinkspythonto that fixed path. Sopython_versionis accepted, validated, and stored — but has zero effect on the running container, with no indication to the user. Reproduced directly againstTrussConfig:No warning was logged for this mismatch on
main.This override is intentional (traced to #1548 — TRT-LLM base images are backend-supplied with their own bundled Python/TensorRT-LLM runtime), so this PR doesn't change that behavior. It only surfaces it, since nothing currently does.
💻 How
Added a
logger.warningintrt_llm_common_validation()(truss/base/trt_llm_config.py), which already runs for every TRT-LLM config (both v1 and v2, viatrt_llm_validation) and already contains a similar warning for another misconfiguration (WEIGHTS_ONLY_INT8quantization on A100). The new check fires whenconfig.python_versiondiffers from the field's default, using the same idiom already established in this function.Considered raising a
ValueErrorinstead, since a few other checks in this function do raise. Went with a warning because settingpython_versionalongsidetrt_llmisn't actually invalid — just inert — so hard-failing would break any existing config that harmlessly sets both. Happy to switch to a hard error if you'd prefer that here.🔬 Testing
Added 3 tests to
truss/tests/trt_llm/test_trt_llm_config.py, reusing the existingtrtllm_config/trtllm_config_v2fixtures and thecaplog.at_level("WARNING")pattern already used intruss/tests/test_config.py:test_trt_llm_non_default_python_version_warns— fails onmain(no warning exists), passes with this change.test_trt_llm_default_python_version_no_warning— the default (py313) config produces no warning; guards against noise on the common case.test_trt_llm_v2_non_default_python_version_warns— same check against a v2 config, sincetrt_llm_common_validationis shared between both inference stacks.Also ran the full non-integration suite:
1651 passed, 19 skipped, 0 failed(no regressions vs. themainbaseline of 1648 passed, 19 skipped), plusruff check .,ruff format . --check, andpre-commit run --all-files(mypy-local, uv-lock, config-schema) — all clean.Out of scope: the original issue also reported a
torch.compile/TritonInductorErrorcrash on newer PyTorch/Triton versions — per the issue thread itself, that's a deployment-environment issue, not something fixable intruss, so this PR only addresses thepython_versionpart.