PagedCacheProto#

Contains ordered KV pages. GraphProto.paged_cache_initializer embeds a named cache as an initializer. Each page selects a dense or encoded payload independently for K and V. Referenced type and quantization catalogues remain model-scoped. See Persistent input/output feedback.

PagedAttention declares past and present as structured values. PagedCacheProto is their serialized page-value representation and carries the dynamic page sequence directly. The runtime RuntimeValue sequence is not a single fixed-layout EncodedValueProto.

class onnx_light.onnx.PagedCacheProto(*args, **kwargs)#

A serializable KV cache. Pages have contiguous token ranges and independently dense or encoded FLOAT [batch,heads,capacity,width] key/value payloads. Model-local type and quantization parameter references are resolved against the containing model.

ByteSize(self) → int#

Returns the serialized size in bytes, following the protobuf API.

Clear(self) → None#

Clears the object.

ClearField(self, field_name: str) → None#

Clears the field field_name, following the protobuf API.

CopyFrom(self, arg: onnx_light.onnx_py._onnxpyprotoop.PagedCacheProto, /) → None#

Copies one instance into this one.

HasField(self, field_name: str) → bool#

Checks if a field is set, following the protobuf HasField API.

ParseFromFile(self, name: str, options: object | None = None, external_data_file: str = '') → None#

Parses a binary file to fill this instance.

ParseFromString(self, data: bytes, options: object | None = None) → None#
ParseFromString(self, data: str, options: object | None = None) → None

Overloaded function.

  1. ParseFromString(self, data: bytes, options: object | None = None) -> None

Parses a sequence of bytes to fill this instance.

  1. ParseFromString(self, data: str, options: object | None = None) -> None

Parses a string to fill this instance.

SerializeSize(self, options: object | None = None) → onnx_light.onnx_py._onnxpyprotoop.SerializeSizeResult#

Returns the size once serialized without serializing.

SerializeToFile(self, name: str, options: object | None = None, external_data_file: str = '') → None#

Serializes this instance into a file. If external_data_size is not empty, big weights are stored in this (depending on options.raw_data_threshold). When writing to two files, temporary external-data metadata is cleared so the in-memory model stays unchanged.

SerializeToFileDescriptor(self, fd: int, options: object | None = None) → None#

Serializes this instance into an open file descriptor without closing it.

SerializeToOStream(self, output: object) → None#

Alias for SerializeToOstream (capital S) for protobuf API compatibility. Serializes this instance to a Python file-like object that has a write() method.

SerializeToOstream(self, output: object) → None#

Serializes this instance to a Python file-like object that has a write() method.

SerializeToString(self, options: object | None = None) → bytes#

Serializes this instance into a sequence of bytes.

property blocks#

Ordered immutable KV pages.

property doc_string#

Human-readable documentation.

has_blocks(self) → bool#

Tells if ‘blocks’ has a value.

has_doc_string(self) → bool#

Tells if ‘doc_string’ has a value

has_name(self) → bool#

Tells if ‘name’ has a value

property name#

Graph-scoped initializer name, unique across initializer categories.

class onnx_light.onnx.PagedCacheBlockProto(*args, **kwargs)#

One immutable KV page with a contiguous logical token range.

ByteSize(self) → int#

Returns the serialized size in bytes, following the protobuf API.

Clear(self) → None#

Clears the object.

ClearField(self, field_name: str) → None#

Clears the field field_name, following the protobuf API.

CopyFrom(self, arg: onnx_light.onnx_py._onnxpyprotoop.PagedCacheBlockProto, /) → None#

Copies one instance into this one.

HasField(self, field_name: str) → bool#

Checks if a field is set, following the protobuf HasField API.

ParseFromFile(self, name: str, options: object | None = None, external_data_file: str = '') → None#

Parses a binary file to fill this instance.

ParseFromString(self, data: bytes, options: object | None = None) → None#
ParseFromString(self, data: str, options: object | None = None) → None

Overloaded function.

  1. ParseFromString(self, data: bytes, options: object | None = None) -> None

Parses a sequence of bytes to fill this instance.

  1. ParseFromString(self, data: str, options: object | None = None) -> None

Parses a string to fill this instance.

SerializeSize(self, options: object | None = None) → onnx_light.onnx_py._onnxpyprotoop.SerializeSizeResult#

Returns the size once serialized without serializing.

SerializeToFile(self, name: str, options: object | None = None, external_data_file: str = '') → None#

Serializes this instance into a file. If external_data_size is not empty, big weights are stored in this (depending on options.raw_data_threshold). When writing to two files, temporary external-data metadata is cleared so the in-memory model stays unchanged.

SerializeToFileDescriptor(self, fd: int, options: object | None = None) → None#

Serializes this instance into an open file descriptor without closing it.

SerializeToOStream(self, output: object) → None#

Alias for SerializeToOstream (capital S) for protobuf API compatibility. Serializes this instance to a Python file-like object that has a write() method.

SerializeToOstream(self, output: object) → None#

Serializes this instance to a Python file-like object that has a write() method.

SerializeToString(self, options: object | None = None) → bytes#

Serializes this instance into a sequence of bytes.

WhichOneof(self, arg: str, /) → object#
add_encoded_key(self) → onnx_light.onnx_py._onnxpyprotoop.EncodedValueProto#

Sets an empty value.

add_encoded_value(self) → onnx_light.onnx_py._onnxpyprotoop.EncodedValueProto#

Sets an empty value.

add_key(self) → onnx_light.onnx_py._onnxpyprotoop.TensorProto#

Sets an empty value.

add_value(self) → onnx_light.onnx_py._onnxpyprotoop.TensorProto#

Sets an empty value.

property encoded_key#

Inline encoded key tensor.

property encoded_value#

Inline encoded value tensor.

has_encoded_key(self) → bool#

Tells if ‘encoded_key’ has a value.

has_encoded_value(self) → bool#

Tells if ‘encoded_value’ has a value.

has_key(self) → bool#

Tells if ‘key’ has a value.

has_length(self) → bool#

Tells if ‘length’ has a value.

has_start(self) → bool#

Tells if ‘start’ has a value.

has_value(self) → bool#

Tells if ‘value’ has a value.

property key#

Inline dense key tensor.

property length#

Number of valid tokens, positive and no greater than capacity.

property start#

Logical offset of the first token.

property value#

Inline dense value tensor.