Python function
token_sampler
token_sampler()β
max.pipelines.lib.token_sampler(sampling_config, device, return_logits=False)
Builds a sampling graph that samples tokens from logits.
-
Parameters:
-
- sampling_config (SamplingConfig) β Sampling configuration (top-k, temperature, etc.).
- device (DeviceRef) β Device for the graph inputs and ops.
- return_logits (bool) β Whether the graph should expose logits as an output.
-
Returns:
-
A graph that takes logits (and optional penalty inputs) and outputs tokens.
-
Return type:
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!