SHA256
PythonSHA256 = Annotated[str, Field(pattern='^[0-9a-f]{64}$')]Declarative weight mappings from a source file to a Keras model; importable without Keras.
SHA256constantTransformattributeTransposeclassPermute the axes, as numpy.transpose.ReshapeclassReshape in C order, as numpy.reshape.GateReorderclassReorder equal gate blocks along axis, for example ONNX LSTM "iofc" to Keras "ifco".SplitclassTake part index of parts equal parts along axis.SumPartsclassAdd parts equal parts along axis, for example an ONNX LSTM's input and recurrent biases.WeightRowclassOne model weight: its source tensors, how they combine, and the transforms to its layout.SourceFormatclassFile formats importweights reads (see heliaedge.importers.readers).SourcePinclassThe one source file a mapping was written for.WeightMappingclassEvery weight of one architecture, from one source format.SHA256 = Annotated[str, Field(pattern='^[0-9a-f]{64}$')]Transform = Annotated[Transpose | Reshape | GateReorder | Split | SumParts, Field(discriminator='kind')]Permute the axes, as numpy.transpose.
Transpose()Permute the axes, as numpy.transpose.
model_config = ConfigDict(frozen=True, extra='forbid')kind: Literal['transpose'] = 'transpose'perm: tuple[int, ...]apply(x: npt.NDArray) -> npt.NDArrayReshape in C order, as numpy.reshape.
Reshape()Reshape in C order, as numpy.reshape.
model_config = ConfigDict(frozen=True, extra='forbid')kind: Literal['reshape'] = 'reshape'shape: tuple[int, ...]apply(x: npt.NDArray) -> npt.NDArrayReorder equal gate blocks along axis, for example ONNX LSTM "iofc" to Keras "ifco".
GateReorder()Reorder equal gate blocks along axis, for example ONNX LSTM "iofc" to Keras "ifco".
source and target name the same gates, one letter each, in their stored orders.
model_config = ConfigDict(frozen=True, extra='forbid')kind: Literal['gate_reorder'] = 'gate_reorder'source: strtarget: straxis: int = 0apply(x: npt.NDArray) -> npt.NDArrayTake part index of parts equal parts along axis.
Split()Take part index of parts equal parts along axis.
A source tensor may feed several rows only through splits that together use every part once.
model_config = ConfigDict(frozen=True, extra='forbid')kind: Literal['split'] = 'split'axis: intparts: int = Field(ge=2)index: int = Field(ge=0)apply(x: npt.NDArray) -> npt.NDArrayAdd parts equal parts along axis, for example an ONNX LSTM's input and recurrent biases.
SumParts()Add parts equal parts along axis, for example an ONNX LSTM’s input and recurrent biases.
model_config = ConfigDict(frozen=True, extra='forbid')kind: Literal['sum_parts'] = 'sum_parts'axis: intparts: int = Field(ge=2)apply(x: npt.NDArray) -> npt.NDArrayOne model weight: its source tensors, how they combine, and the transforms to its layout.
WeightRow()One model weight: its source tensors, how they combine, and the transforms to its layout.
model_config = ConfigDict(frozen=True, extra='forbid')sources: tuple[str, ...] = Field(min_length=1)Source tensor names. Several sources are combined by combine before transforms.
combine: Literal['sum', 'concat'] | None = Nonesum (for example an LSTM’s input and recurrent biases) or concat along
concat_axis; required with several sources.
concat_axis: int = 0transforms: tuple[Transform, ...] = ()Applied in order to the (combined) source. A Split may only come first and
only with one source.
layer: strName of the Keras layer holding the weight (outer/inner for a nested model).
weight: strName of the weight within the layer, such as kernel or bias, or its path inside a
composite layer, such as query/kernel in a MultiHeadAttention.
source_shape: tuple[Annotated[int, Field(ge=0)], ...] | None = NoneThe shape every source tensor must have, checked before combine and
transforms; None checks only the final shape. A Reshape alone cannot tell a
transposed source of the same size from the right one.
split: Split | NoneThis row's weight value from the source tensors.
value(tensors: dict[str, npt.NDArray]) -> npt.NDArrayThis row’s weight value from the source tensors.
File formats importweights reads (see heliaedge.importers.readers).
SourceFormat()File formats import_weights reads (see helia_edge.importers.readers).
ONNX = 'onnx'SAFETENSORS = 'safetensors'TORCH = 'torch'The one source file a mapping was written for.
SourcePin()The one source file a mapping was written for.
model_config = ConfigDict(frozen=True, extra='forbid')uri: strsha256: SHA256format: SourceFormatnote: str = ''Every weight of one architecture, from one source format.
WeightMapping()Every weight of one architecture, from one source format.
model_config = ConfigDict(frozen=True, extra='forbid')name: strMapping name.
source: SourcePinThe pinned source file and its format.
rows: tuple[WeightRow, ...] = Field(min_length=1)One row per model weight.
unused: tuple[str, ...] = ()Source tensors deliberately not imported (every other one must be used).