From 69da7f56937a3db2391994ccbbab57016b0219e9 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 14 Mar 2024 15:48:19 +0100 Subject: [PATCH 1/4] add ARBITRARY_SIZE for convenience --- bioimageio/spec/model/v0_5.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bioimageio/spec/model/v0_5.py b/bioimageio/spec/model/v0_5.py index e2f48d258..ed88e0b58 100644 --- a/bioimageio/spec/model/v0_5.py +++ b/bioimageio/spec/model/v0_5.py @@ -246,6 +246,9 @@ def get_size(self, n: ParameterizedSize.N) -> int: return self.min + self.step * n +ARBITRARY_SIZE = ParameterizedSize(min=1, step=1) + + class SizeReference(Node): """A tensor axis size (extent in pixels/frames) defined in relation to a reference axis. From d0c7988ba0dc6e2cbe1f7e13a5aa69d84992f9e2 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 14 Mar 2024 15:54:47 +0100 Subject: [PATCH 2/4] ensure architecture kwargs are yaml serializable --- bioimageio/spec/model/v0_5.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bioimageio/spec/model/v0_5.py b/bioimageio/spec/model/v0_5.py index ed88e0b58..1b5714733 100644 --- a/bioimageio/spec/model/v0_5.py +++ b/bioimageio/spec/model/v0_5.py @@ -60,7 +60,7 @@ from .._internal.io import BioimageioYamlContent as BioimageioYamlContent from .._internal.io import FileDescr as FileDescr from .._internal.io import Sha256 as Sha256 -from .._internal.io import WithSuffix, download +from .._internal.io import WithSuffix, YamlValue, download from .._internal.io_basics import AbsoluteFilePath as AbsoluteFilePath from .._internal.io_utils import load_array from .._internal.types import Datetime as Datetime @@ -1467,7 +1467,7 @@ class _ArchitectureCallableDescr(Node): callable: Annotated[Identifier, Field(examples=["MyNetworkClass", "get_my_model"])] """Identifier of the callable that returns a torch.nn.Module instance.""" - kwargs: Dict[str, Any] = Field(default_factory=dict) + kwargs: Dict[str, YamlValue] = Field(default_factory=dict) """key word arguments for the `callable`""" From 62d865999be09fdf97cbeb07f22bc2ec9a9bef3d Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 14 Mar 2024 15:55:47 +0100 Subject: [PATCH 3/4] add optional flag --- bioimageio/spec/model/v0_5.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bioimageio/spec/model/v0_5.py b/bioimageio/spec/model/v0_5.py index 1b5714733..17d656c05 100644 --- a/bioimageio/spec/model/v0_5.py +++ b/bioimageio/spec/model/v0_5.py @@ -1031,6 +1031,9 @@ class InputTensorDescr(TensorDescrBase[InputAxis]): """Input tensor id. No duplicates are allowed across all inputs and outputs.""" + optional: bool = False + """indicates that this tensor may be `None`""" + preprocessing: List[PreprocessingDescr] = Field(default_factory=list) """Description of how this input should be preprocessed.""" From 82b90daba1727afa64a69d28c89238d259e40781 Mon Sep 17 00:00:00 2001 From: fynnbe Date: Thu, 14 Mar 2024 16:00:33 +0100 Subject: [PATCH 4/4] add changelog entry --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index db6af79e6..91f84382b 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,11 @@ Made with [contrib.rocks](https://contrib.rocks). ### Resource Description Format Versions +#### model 0.5.1 (planned) + +* Non-breaking changes + * added optional `inputs.i.optional` field to indicate that a tensor may be `None` + #### generic 0.3.0 / application 0.3.0 / collection 0.3.0 / dataset 0.3.0 / notebook 0.3.0 * Breaking canges that are fully auto-convertible