class documentation

Build NN Archive files from configuration and model executables.

The generated archive is a compressed tar file that contains config.json and the provided executable files.

Method __init__ Create a generator for an NN Archive.
Method make_archive Generate the NN Archive file.
Instance Variable archive_name Archive file name, including the .tar and compression suffix.
Instance Variable cfg Validated archive configuration.
Instance Variable compression Compression algorithm used for the tar archive.
Instance Variable executables_paths Paths to executable files included in the archive.
Instance Variable save_path Directory where the archive is written.
Method _make_json Create an in-memory config.json file.
def __init__(self, archive_name: str, save_path: PathType, cfg_dict: dict, executables_paths: list[PathType], compression: Literal['xz', 'gz', 'bz2'] = 'xz'):

Create a generator for an NN Archive.

Parameters
archive_name:strDesired archive file name. The .tar and compression suffix are added if missing.
save_path:PathTypeDirectory where the archive should be written.
cfg_dict:dictArchive configuration used to build config.json.
executables_paths:list[PathType]Paths to model executable files to include.
compression:Literal['xz', 'gz', 'bz2']Compression algorithm for the tar archive.
Raises
ValueErrorIf compression is not one of "xz", "gz", or "bz2".
def make_archive(self) -> Path:

Generate the NN Archive file.

Returns
PathPath to the generated archive.
archive_name =

Archive file name, including the .tar and compression suffix.

cfg =

Validated archive configuration.

compression =

Compression algorithm used for the tar archive.

executables_paths =

Paths to executable files included in the archive.

save_path =

Directory where the archive is written.

def _make_json(self) -> tuple[bytes, BytesIO]:

Create an in-memory config.json file.

Returns
tuple[bytes, BytesIO]Encoded JSON data and a file-like buffer containing it.