vllm.v1.worker.cpu.model_states.interface
¶
Classes:
-
ModelSpecificAttnMetadata–Base class for model-specific attention metadata.
-
ModelState–
ModelSpecificAttnMetadata
¶
Base class for model-specific attention metadata.
ModelState
¶
Bases: ABC
Methods:
-
dummy_inputs_embeds–Pre-allocated inputs_embeds buffer for dummy runs (contents unused).
-
execute_mm_encoder–Run the multi-modal encoder and cache its outputs by
mm_hash. -
gather_mm_embeddings–Gather cached multimodal embeddings.
-
initialize_kv_cache–Hook run after the KV cache tensors are allocated and bound.
-
prepare_inputs_embeds–Prepare the
inputs_embedstensor for the current forward pass. -
preprocess_state–Hook run on real batches before the forward pass (after block tables
Attributes:
-
num_new_sampled_tokens_per_step(int) –New tokens sampled on each decode step
num_new_sampled_tokens_per_step = 1
class-attribute
instance-attribute
¶
New tokens sampled on each decode step (excluding accepted draft tokens, a.k.a num bonus tokens).
dummy_inputs_embeds(num_tokens)
¶
Pre-allocated inputs_embeds buffer for dummy runs (contents unused).
execute_mm_encoder(scheduled_encoder_inputs)
¶
Run the multi-modal encoder and cache its outputs by mm_hash.
The encode half of get_mm_embeddings, without the gather, for callers
that run no language model.
gather_mm_embeddings(input_batch)
¶
Gather cached multimodal embeddings.
initialize_kv_cache(kv_cache_config, block_tables)
¶
Hook run after the KV cache tensors are allocated and bound.
prepare_inputs_embeds(scheduled_encoder_inputs, input_batch, req_states)
abstractmethod
¶
Prepare the inputs_embeds tensor for the current forward pass.
preprocess_state(input_batch, block_tables, kv_cache_config, num_computed_tokens)
¶
Hook run on real batches before the forward pass (after block tables are gathered). Used by mamba prefix caching to pre-copy state across block boundaries. No-op by default.