# archive_generator

Python API: `luxonis_ml.nn_archive.archive_generator`

## Classes

| Name | Description |
| --- | --- |
|
[`ArchiveGenerator`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/nn_archive/archive_generator.md)
| Build NN Archive files from configuration and model executables. |

### class `ArchiveGenerator`

```python
class ArchiveGenerator
```

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.

Attributes

| Name | Description |
| --- | --- |
| `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. |

Methods

| Name | Description |
| --- | --- |
|
[`__init__`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/nn_archive/archive_generator.md)
| Create a generator for an NN Archive. |
|
[`make_archive`](https://docs.luxonis.com/software-v3/ai-inference/model-source/training/luxonis-ml/luxonis-ml-api-reference/nn_archive/archive_generator.md)
| Generate the NN Archive file. |

#### method `__init__`

```python
def __init__(
    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.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `archive_name` | `str` | Desired archive file name. The `.tar` and compression suffix are added if missing. | required |
| `save_path` | `PathType` | Directory where the archive should be written. | required |
| `cfg_dict` | `dict` | Archive configuration used to build `config.json`. | required |
| `executables_paths` | `list[PathType]` | Paths to model executable files to include. | required |
| `compression` | `Literal['xz', 'gz', 'bz2']` | Compression algorithm for the tar archive. | `'xz'` |

Raises

| Type | Description |
| --- | --- |
| `ValueError` | If `compression` is not one of `"xz"`, `"gz"`, or `"bz2"`. |

#### method `make_archive`

```python
def make_archive() -> Path
```

Generate the NN Archive file.

Returns

| Type | Description |
| --- | --- |
| `Path` | Path to the generated archive. |
