Skip to content
heliaEDGE
Reference
HELIA

reproduce

Reproduce an export from its record (helia-edge export reproduce) and create one from a spec file.

Machine-readable model

  • ReproductionclassWhat reproduce found.
  • file_sha256functionsha256 of a file's bytes.
  • load_npyfunctionA .npy array, memory-mapped, so that a header claiming more data than the file holds is refused rather than allocated.
  • load_specfunctionA ModelSpec from a YAML (.yaml/.yml) or JSON file.
  • family_mappingfunctionThe weight mapping name of the spec's family (its params module's MAPPINGS).
  • environment_differencesfunctionHow current differs from recorded, in the versions that can change exported bytes.
  • litert_unavailablefunctionWhy this process cannot export LiteRT, one line each; empty when it can.
  • reproducefunctionRebuild the model a record describes, export it again with the same settings and compare.
  • imported_sourcefunctionThe record of weights imported through mapping from a file with sha256.
class

What reproduce found.

helia_edge/export/reproduce.py:14

Reproduction(
status: Literal['same', 'different', 'environment', 'input'],
differences: tuple[str, ...] = (),
environment: tuple[str, ...] = (),
skipped: tuple[str, ...] = (),
) -> None

dataclass

What reproduce found.

attribute

status

Python

helia_edge/export/reproduce.py:27

status: Literal['same', 'different', 'environment', 'input']

same (same artifact, I/O and golden), different, environment (the environment differs and the comparison was not made) or input (a file is missing or does not match the record).

function

load_npy

Python

A .npy array, memory-mapped, so that a header claiming more data than the file holds is refused rather than allocated.

helia_edge/export/reproduce.py:42

load_npy(path: Path | str) -> np.ndarray

A .npy array, memory-mapped, so that a header claiming more data than the file holds is refused rather than allocated.

Errors raised by load_npy
TypeDescription
ValueErrorIf the file cannot be read as a ``.npy`` array.
function

load_spec

Python

A ModelSpec from a YAML (.yaml/.yml) or JSON file.

helia_edge/export/reproduce.py:59

load_spec(path: Path | str)

A ModelSpec from a YAML (.yaml/.yml) or JSON file.

Errors raised by load_spec
TypeDescription
ValueErrorIf the file is not valid YAML or JSON, or not a valid ``ModelSpec``.
function

The weight mapping name of the spec's family (its params module's MAPPINGS).

helia_edge/export/reproduce.py:79

family_mapping(spec, name: str)

The weight mapping name of the spec’s family (its params module’s MAPPINGS).

function

How current differs from recorded, in the versions that can change exported bytes.

helia_edge/export/reproduce.py:87

environment_differences(recorded: EnvironmentEntry, current: EnvironmentEntry) -> list[str]

How current differs from recorded, in the versions that can change exported bytes.

function

reproduce

Python

Rebuild the model a record describes, export it again with the same settings and compare.

helia_edge/export/reproduce.py:141

reproduce(
record_path: Path | str,
weights: Path | str,
calibration: Path | str | None = None,
golden_inputs: Path | str | None = None,
allow_env_mismatch: bool = False,
) -> Reproduction

Rebuild the model a record describes, export it again with the same settings and compare.

Parameters of reproduce
NameTypeDefaultDescription
record_pathPath | strRequiredThe ``record.json``.
weightsPath | strRequiredThe ``.weights.h5`` file, or for imported weights the source file the mapping imports.
calibrationPath | str | NoneNoneThe calibration ``.npy``, when the record has calibration.
golden_inputsPath | str | NoneNoneThe golden's input ``.npy``, to regenerate and compare the golden.
allow_env_mismatchboolFalseCompare even when the environment differs from the record's.
Returns of reproduce
ValueTypeDescription
ReproductionReproduction``same`` when the weights digest, the export settings, the artifact, the I/O, the golden
Reproduction(with ``golden_inputs``) and the ``model.tflite`` and ``golden.npz`` beside the record (when present)
Reproductionmatch. A failure of the export itself is raised.
function

The record of weights imported through mapping from a file with sha256.

helia_edge/export/reproduce.py:241

imported_source(mapping, sha256: str) -> WeightImport

The record of weights imported through mapping from a file with sha256.