From 5f397d6777765860a2300a6b688a20ddfbbf1c11 Mon Sep 17 00:00:00 2001 From: handongl Date: Fri, 24 Jul 2026 06:59:27 -0700 Subject: [PATCH 1/2] [nvbugs/6507080][fix] Add safe __repr__ to TokenizerBase PreTrainedTokenizerBase.__repr__ reads properties (e.g. added_tokens_decoder) that TokenizerBase subclasses are not required to implement. When a user-supplied custom tokenizer becomes a field of the pydantic llm_args model, logging f"LLM Args:\n{llm_args}" in py_executor_creator triggers pydantic's __repr__, which recursively calls repr() on the tokenizer and blows up with NotImplementedError. Override __repr__ on TokenizerBase to return a class-name-only string so pydantic reprs and startup logging never crash on custom tokenizers. Signed-off-by: handongl --- tensorrt_llm/tokenizer/tokenizer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tensorrt_llm/tokenizer/tokenizer.py b/tensorrt_llm/tokenizer/tokenizer.py index 1422cc3804b5..dbc92aee8b0f 100644 --- a/tensorrt_llm/tokenizer/tokenizer.py +++ b/tensorrt_llm/tokenizer/tokenizer.py @@ -61,6 +61,12 @@ class TokenizerBase(PreTrainedTokenizerBase): ''' This is a protocol for the tokenizer. Users can implement their own tokenizer by inheriting this class. ''' + def __repr__(self) -> str: + # PreTrainedTokenizerBase.__repr__ reads properties (e.g. + # added_tokens_decoder) that TokenizerBase subclasses are not + # required to implement, so fall back to a class-name-only repr. + return f"{self.__class__.__name__}()" + def _reconstruct_transformers_tokenizer(inner_bytes: bytes): '''Reconstruct a TransformersTokenizer from cloudpickle-serialized bytes.''' From 30b981f5ac92507f2a840193ac2ad3cc55903099 Mon Sep 17 00:00:00 2001 From: handongl Date: Fri, 24 Jul 2026 12:36:21 -0700 Subject: [PATCH 2/2] [nvbugs/6507080][chore] Remove stale waiver after fix Signed-off-by: handongl --- tests/integration/test_lists/waives.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/integration/test_lists/waives.txt b/tests/integration/test_lists/waives.txt index 6dc4776bb633..ff7b378da100 100644 --- a/tests/integration/test_lists/waives.txt +++ b/tests/integration/test_lists/waives.txt @@ -376,7 +376,6 @@ unittest/executor/test_rpc_proxy.py SKIP (https://nvbugs/5605741) unittest/executor/test_rpc_worker.py SKIP (https://nvbugs/5605741) unittest/llmapi/test_additional_model_outputs.py -m "gpu2" SKIP (https://nvbugs/6428091) unittest/llmapi/test_additional_model_outputs.py::test_additional_model_outputs_integration_pp2 SKIP (https://nvbugs/6427411) -unittest/llmapi/test_llm.py::test_llm_with_customized_tokenizer SKIP (https://nvbugs/6507080) unittest/llmapi/test_llm.py::test_openai_completion_list_prompt_stream_reuses_stream_metadata SKIP (https://nvbugs/6507081) unittest/llmapi/test_llm.py::test_tokenizer_decode_incrementally[/scratch.trt_llm_data/llm-models/falcon-7b-instruct-False-0.95-HF] SKIP (https://nvbugs/6507082) unittest/llmapi/test_llm.py::test_tokenizer_decode_incrementally[/scratch.trt_llm_data/llm-models/falcon-7b-instruct-False-0.95-TRTLLM] SKIP (https://nvbugs/6507082)