vllm.v1.worker.cpu.rope
¶
Classes:
-
RopeState–State for multi-dimensional (M-RoPE) positions.
Functions:
-
get_rope_state–Create a RopeState if the model uses multi-dimensional RoPE.
RopeState
¶
State for multi-dimensional (M-RoPE) positions.
num_dims is the number of position channels the model consumes, which
the model config derives from its M-RoPE sections.
NOTE: positions is implemented with one additional dummy position on
purpose to make it non-contiguous so that it can work with torch compile.
See detailed explanation in
https://github.com/vllm-project/vllm/pull/12128#discussion_r1926431923
NOTE: For text-only inputs, each dimension has identical position IDs, making M-RoPE functionally equivalent to 1D-RoPE. See page 5 of https://arxiv.org/abs/2409.12191
Methods:
-
read_prefill_positions–Return per-request prefill positions as [num_dims, length].
-
update_prefill_positions–Overwrite a request's prefill positions with recomputed values.
Source code in vllm/v1/worker/cpu/rope.py
read_prefill_positions(req_idx, length)
¶
Return per-request prefill positions as [num_dims, length].
update_prefill_positions(req_idx, positions, delta)
¶
Overwrite a request's prefill positions with recomputed values.
Source code in vllm/v1/worker/cpu/rope.py
get_rope_state(model_config, model, max_num_reqs, max_num_tokens, max_model_len, device)
¶
Create a RopeState if the model uses multi-dimensional RoPE.