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
5 changes: 3 additions & 2 deletions docs/source/features/sampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ The PyTorch backend supports a wide variety of features, listed below:
There are two sampling backends available.

* Torch Sampler
* TRTLLM Sampler
* TRTLLM Sampler (deprecated)

Torch Sampler currently supports a superset of features of TRTLLM Sampler, and is intended as the long-term solution. One can specify which sampler to use explicitly with:
Torch Sampler is used by default and supports a superset of features of TRTLLM Sampler. TRTLLM Sampler will be removed in release 1.4.
One can specify which sampler to use explicitly with:

```python
from tensorrt_llm import LLM
Expand Down
7 changes: 4 additions & 3 deletions tensorrt_llm/_torch/pyexecutor/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,9 +1429,10 @@ def instantiate_sampler(
if mm_encoder_only:
# NOTE: handle model outputs specially for mm encoder executor/engine
return EarlyStopWithMMResult()
if llm_args.sampler_type == SamplerType.TRTLLMSampler or (
llm_args.sampler_type == SamplerType.auto
and decoding_mode.isBeamSearch()):
if llm_args.sampler_type == SamplerType.TRTLLMSampler:
logger.warning(
"TRTLLMSampler is deprecated and will be removed in release 1.4. Please use TorchSampler instead."
)
logger.debug(f"DecodingMode: {decoding_mode.name}")
return TRTLLMSampler(engine.model,
engine.dtype,
Expand Down
8 changes: 6 additions & 2 deletions tensorrt_llm/llmapi/llm_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -3268,8 +3268,12 @@ class TorchLlmArgs(BaseLlmArgs):
sampler_type: Union[str, SamplerType] = Field(
default=SamplerType.auto,
description=
"The type of sampler to use. Options are TRTLLMSampler, TorchSampler or auto. Defaults to auto, which will use TorchSampler unless BeamSearch is requested.",
status="beta")
"The type of sampler to use. Options are TRTLLMSampler, TorchSampler or auto. Defaults to auto, which will use TorchSampler. "
"TRTLLMSampler is deprecated and will be removed in release 1.4.",
status="deprecated",
deprecated=
"This parameter will be removed in release 1.4. TorchSampler will be the default sampler."
)

sampler_force_async_worker: bool = Field(
default=False,
Expand Down
2 changes: 1 addition & 1 deletion tests/unittest/api_stability/references/llm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ methods:
sampler_type:
annotation: Union[str, tensorrt_llm.llmapi.llm_args.SamplerType]
default: auto
status: beta
status: deprecated
sampler_force_async_worker:
annotation: bool
default: False
Expand Down
Loading