vllm.v1.worker.gpu.spec_decode.utils
¶
Classes:
Functions:
-
get_drafter_hidden_states–Hidden states fed to the drafter.
-
get_parallel_drafting_token_id–Resolve the mask token id used for parallel drafting slots.
-
get_pp_safe_draft_load_config–Avoid collectives that include PP ranks without a draft model.
DraftTokensHandler
¶
Methods:
-
get_draft_tokens–Return the latest drafts needed for the current step's deferred
Source code in vllm/v1/worker/gpu/spec_decode/utils.py
get_draft_tokens()
¶
Return the latest drafts needed for the current step's deferred grammar bitmask, or for all live requests if sampling isn't deferred. Requests without retained drafts are omitted.
Source code in vllm/v1/worker/gpu/spec_decode/utils.py
get_drafter_hidden_states(model, hidden_states)
¶
Hidden states fed to the drafter.
Targets such as DeepSeek V4 expose the pre-hc_head residual through get_mtp_target_hidden_states(). The buffer is sized at max_num_batched_tokens and only allocated for drafters that consume target hidden states, so None means "use the regular hidden states".
Source code in vllm/v1/worker/gpu/spec_decode/utils.py
get_parallel_drafting_token_id(hf_config)
¶
Resolve the mask token id used for parallel drafting slots.
Checks (in order): dflash_config.mask_token_id, top-level mask_token_id,
dspark_noise_token_id, pard_token, ptd_token_id. Raises ValueError if
none are present.
Source code in vllm/v1/worker/gpu/spec_decode/utils.py
get_pp_safe_draft_load_config(load_config)
¶
Avoid collectives that include PP ranks without a draft model.