Skip to content

vllm_omni.worker.sampling_utils

Sampling-state guards shared by the GPU and NPU AR model runners.

logger module-attribute

logger = init_logger(__name__)

sanitize_min_tokens_stop_ids

sanitize_min_tokens_stop_ids(
    logitsprocs: LogitsProcessors, logits_vocab: int
) -> None

Drop stop ids the model head cannot emit from min-tokens masking state.

vLLM's input processor unconditionally folds the stage tokenizer's EOS id into SamplingParams.all_stop_token_ids. AR stages whose lm_head is narrower than the tokenizer vocabulary (codec talkers such as Qwen3-TTS: 3072 logits vs text EOS 151645) then crash on any min_tokens >= 1: MinTokensLogitsProcessor.apply writes -inf at an out-of-range index and index_put_ triggers a CUDA device-side assert (#4962).

Out-of-range ids are unreachable for the head, so dropping them never changes sampling or stopping behavior. The per-request stop-id set is mutated in place (it is shared with the request's SamplingParams), so each request is sanitized at most once; the processor's device-side mask slice is rebuilt only when an out-of-range id was found.