From e34965d16fbc4fab856a1ea92f1fc66319e1d265 Mon Sep 17 00:00:00 2001 From: KlemenSkrlj <47853619+klemen1999@users.noreply.github.com> Date: Wed, 16 Oct 2024 18:40:08 +0200 Subject: [PATCH] [Hotfix] Config version set to 1.0 (#190) --- luxonis_ml/__init__.py | 2 +- luxonis_ml/nn_archive/config.py | 4 +++- tests/test_nn_archive/test_nn_archive.py | 20 ++++++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/luxonis_ml/__init__.py b/luxonis_ml/__init__.py index 6a9beea8..3d26edf7 100644 --- a/luxonis_ml/__init__.py +++ b/luxonis_ml/__init__.py @@ -1 +1 @@ -__version__ = "0.4.0" +__version__ = "0.4.1" diff --git a/luxonis_ml/nn_archive/config.py b/luxonis_ml/nn_archive/config.py index 7362dea6..e3f408f8 100644 --- a/luxonis_ml/nn_archive/config.py +++ b/luxonis_ml/nn_archive/config.py @@ -6,7 +6,9 @@ from .model import Model -CONFIG_VERSION = Literal["1.0", "1.1"] +# NOTE: Change in CONFIG_VERSION is a breaking change and should be communicated +# to all other packages that relly on it before pushed to release +CONFIG_VERSION = Literal["1.0"] class Config(BaseModelExtraForbid): diff --git a/tests/test_nn_archive/test_nn_archive.py b/tests/test_nn_archive/test_nn_archive.py index 7cff6f6f..d407d681 100644 --- a/tests/test_nn_archive/test_nn_archive.py +++ b/tests/test_nn_archive/test_nn_archive.py @@ -20,7 +20,7 @@ from pydantic import ValidationError from luxonis_ml.nn_archive import ArchiveGenerator, is_nn_archive -from luxonis_ml.nn_archive.model import Input, Output +from luxonis_ml.nn_archive.model import HeadType, Input, Output DATA_DIR = Path("tests/data/test_nn_archive") @@ -91,7 +91,7 @@ def test_archive_generator( archive_name=archive_name, save_path="tests/data/test_nn_archive", cfg_dict={ - "config_version": "1.1", + "config_version": "1.0", "model": { "metadata": { "name": "test_model", @@ -132,6 +132,22 @@ def test_archive_generator( assert "config.json" in tar.getnames() +def test_optional_head_name(): + from luxonis_ml.nn_archive.config_building_blocks.base_models.head_metadata import ( + HeadMetadata, + ) + + # without head name + HeadType(parser="Parser", metadata=HeadMetadata(), outputs=["output"]) # type: ignore + # with head name + HeadType( + parser="Parser", + name="HeadName", + metadata=HeadMetadata(), # type: ignore + outputs=["output"], + ) + + def test_layout(): default = { "name": "input",