vllm.model_executor.models.transformers.tpsp_runtime
¶
Transformers TPSP backends and runtime contexts.
Classes:
-
TPSPBackend– -
TPSPContext–Shared backend and named per-group handles.
-
TPSPOpsGroup–A consecutive projection and normalization pair.
-
TPSPProfile–Shared TPSP activation decision.
-
UnsupportedTPSPModelError–Transformers model structure not supported by the TPSP path.
-
UnsupportedTPSPNormError–Normalization not supported by the Transformers TPSP path.
Functions:
-
get_tpsp_norm_type–Identify known normalization implementations without guessing by attributes.
-
tpsp_shard_residual–Return the current TP rank's padded shard of a full residual.
TPSPBackend
¶
Bases: ABC
Methods:
-
open–Initialize backend resources once, before configuring ops groups.
-
prepare_weights–Prepare backend-specific weights after model weights are loaded.
-
profile–Configure named ops groups on an already-open backend.
Source code in vllm/model_executor/models/transformers/tpsp_runtime.py
_create_context()
abstractmethod
¶
open(*, dtype, tp_size, hidden_size, max_batched_tokens, group_name, device)
abstractmethod
¶
Initialize backend resources once, before configuring ops groups.
Source code in vllm/model_executor/models/transformers/tpsp_runtime.py
prepare_weights(projections)
¶
profile(ops_groups, max_batched_tokens, *, microchunk_tokens=None, threshold_tokens=None)
abstractmethod
¶
Configure named ops groups on an already-open backend.
Parameters:
-
(ops_groups¶Sequence[TPSPOpsGroup]) –Named projection and normalization pairs to configure.
-
(max_batched_tokens¶int) –Maximum scheduler token count.
-
(microchunk_tokens¶int | None, default:None) –Optional global token-size override.
-
(threshold_tokens¶int | None, default:None) –Optional global token threshold override.
Returns:
-
TPSPContext | None–The TPSP context, or None when unsupported.
Source code in vllm/model_executor/models/transformers/tpsp_runtime.py
TPSPContext
dataclass
¶
TPSPOpsGroup
dataclass
¶
TPSPProfile
dataclass
¶
Shared TPSP activation decision.
Source code in vllm/model_executor/models/transformers/tpsp_runtime.py
UnsupportedTPSPModelError
¶
Bases: ValueError
Transformers model structure not supported by the TPSP path.
UnsupportedTPSPNormError
¶
Bases: ValueError
Normalization not supported by the Transformers TPSP path.
get_tpsp_norm_type(norm)
¶
Identify known normalization implementations without guessing by attributes.
Source code in vllm/model_executor/models/transformers/tpsp_runtime.py
tpsp_shard_residual(residual)
¶
Return the current TP rank's padded shard of a full residual.