Skip to content

vllm.v1.worker.cpu.sampler

Classes:

CPUSampler

Methods:

  • get_logprobs_dims –

    (num_logprobs, max_per_req_token_ids) for the given requests, or

get_logprobs_dims(idx_mapping_np, include_token_ids=True)

(num_logprobs, max_per_req_token_ids) for the given requests, or None when none of them want logprobs.

CPUSamplingStates

Methods:

get_top_k_top_p(expanded_idx_mapping, idx_mapping_np, vocab_size)

Returns (top_k, top_p, has_topp_only_rows).

CPUThinkingBudgetState

Model Runner V2 state for per-request thinking token budgets.

CPUTraceReplayState

Per-request state for inference trace-replay.

When a request carries SamplingParams.trace_decode_token_ids, the sampler overwrites the sampled token at each decode step with the predetermined trace token, while real logprobs and ranks are still computed from the unmodified logit distribution.