flat¶
flat
¶
Flat: a [tokens, ...] tensor of one vLLM request, served in nnterp's layout as a private copy.
Flat
¶
Flat(*args: Any, heads: str | None = None, batch: bool | Callable[[Envoy], bool] = False, factor: Callable[[Envoy], float] | None = None, **kwargs: Any)
Bases: EProperty
An EProperty over a [tokens, ...] tensor, served as a private [1, tokens, ...] copy.
Takes what EProperty takes (a path for a key, select for one
argument of a call). The decorated function receives the batched copy and
returns the value; its annotation is the layout. In-place edits are handed
back to the model when the block moves on, and an assignment is checked
against the rows this request has before it is swapped in. An output
that is a tuple serves its first element unless select says another:
a norm vLLM calls with the residual beside the stream returns
(normed, residual), and the same norm called alone returns the tensor.
| PARAMETER | DESCRIPTION |
|---|---|
heads
|
For a
TYPE:
|
batch
|
Whether the tensor already carries the batch axis,
TYPE:
|
factor
|
For a value that is the tensor times a scalar of the model
(Granite's
TYPE:
|
on_transformers_backend
¶
Whether envoy's model runs on vLLM's transformers backend, where every activation carries the batch axis.
batched
¶
[tokens, ...] as a private [1, tokens, ...] copy; with head_dim, the last axis split into heads.
[tokens, num_heads * head_dim] (or [tokens, num_heads, head_dim], where a
module keeps its heads apart) becomes [1, tokens, num_heads, head_dim], or
[1, num_heads, tokens, head_dim] with heads_first.
unbatched
¶
unbatched(value: Tensor, rows: Tensor, name: str, head_dim: int | None = None, heads_first: bool = False) -> Tensor
What batched served, back as the [tokens, ...] the model holds, refusing another shape.
A written value is spliced into the step the engine is running, among other requests' rows. One of the wrong height would reach the next kernel as it is, where the mismatch can end the engine and every request in it, so it is refused here, in the block that wrote it.