Skip to content

Commit

Permalink
Merge pull request #552 from bioimage-io/cosmetic_updates
Browse files Browse the repository at this point in the history
Cosmetic updates
  • Loading branch information
FynnBe authored Mar 12, 2024
2 parents 859f5bd + b363a25 commit e89bf57
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 110 deletions.
2 changes: 0 additions & 2 deletions bioimageio/spec/model/v0_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ class AxisBase(NodeWithExplicitlySetFields):

description: Annotated[str, MaxLen(128)] = ""

__hash__ = NodeWithExplicitlySetFields.__hash__


class WithHalo(Node):
halo: Annotated[int, Ge(0)] = 0
Expand Down
94 changes: 0 additions & 94 deletions example_descriptions/models/unet2d_nuclei_broad/rdf.yaml.wip

This file was deleted.

22 changes: 13 additions & 9 deletions example_use/load_model_and_create_your_own.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@
"else:\n",
" raise NotImplementedError(example_model_id)\n",
"\n",
"model = load_description(url, format_version=\"latest\")\n",
"if isinstance(model, InvalidDescr):\n",
" raise ValueError(f\"Failed to load {example_model_id}:\\n{model.validation_summary.format()}\")\n",
"elif not isinstance(model, ModelDescr):\n",
"loaded_descr = load_description(url, format_version=\"latest\")\n",
"if isinstance(loaded_descr, InvalidDescr):\n",
" raise ValueError(f\"Failed to load {example_model_id}:\\n{loaded_descr.validation_summary.format()}\")\n",
"elif not isinstance(loaded_descr, ModelDescr):\n",
" raise ValueError(\"This notebook expects a model description\")\n",
"else:\n",
" model = loaded_descr\n",
"\n",
"print(f\"loaded '{model.name}'\")\n"
]
Expand Down Expand Up @@ -264,12 +266,12 @@
"source": [
"output_axes = [\n",
" BatchAxis(),\n",
" ChannelAxis(channel_names=[\"membrane\"])]\n",
" ChannelAxis(channel_names=[Identifier(\"membrane\")])]\n",
"if example_model_id == \"impartial-shrimp\":\n",
" output_axes += [\n",
" SpaceInputAxis(id=AxisId(\"z\"), size=ParameterizedSize(min=16, step=8)), # implicitly same size as raw.z as it is parametrized the same.\n",
" SpaceInputAxis(id=AxisId('y'), size=ParameterizedSize(min=144, step=72)),\n",
" SpaceInputAxis(id=AxisId('x'), size=ParameterizedSize(min=144, step=72))\n",
" SpaceOutputAxis(id=AxisId(\"z\"), size=ParameterizedSize(min=16, step=8)), # implicitly same size as raw.z as it is parametrized the same.\n",
" SpaceOutputAxis(id=AxisId('y'), size=ParameterizedSize(min=144, step=72)),\n",
" SpaceOutputAxis(id=AxisId('x'), size=ParameterizedSize(min=144, step=72))\n",
" ]\n",
"elif example_model_id == \"pioneering-rhino\":\n",
" output_axes += [\n",
Expand Down Expand Up @@ -320,12 +322,14 @@
"metadata": {},
"outputs": [],
"source": [
"from bioimageio.spec.model.v0_5 import LicenseId\n",
"\n",
"my_model_descr = ModelDescr(\n",
" name=\"My cool model\",\n",
" description=\"A test model for demonstration purposes only\",\n",
" authors=[Author(name=\"me\", affiliation=\"my institute\", github_user=\"bioimageiobot\")], # change github_user to your GitHub account name\n",
" cite=[CiteEntry(text=\"for model training see my paper\", doi=Doi(\"10.1234something\"))],\n",
" license=\"MIT\",\n",
" license=LicenseId(\"MIT\"),\n",
" documentation=HttpUrl(\"https://raw.githubusercontent.com/bioimage-io/spec-bioimage-io/main/README.md\"),\n",
" git_repo=HttpUrl(\"https://github.com/bioimage-io/spec-bioimage-io\"), # change to repo where your model is developed\n",
" inputs=[input_descr],\n",
Expand Down
6 changes: 1 addition & 5 deletions tests/test_example_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

import pytest

from bioimageio.spec._description import DISCOVER, LATEST
from bioimageio.spec._internal.types import FormatVersionPlaceholder
from tests.conftest import EXAMPLE_DESCRIPTIONS
from tests.utils import ParameterSet, check_bioimageio_yaml

Expand Down Expand Up @@ -48,18 +46,16 @@ def yield_invalid_descr_paths() -> Iterable[ParameterSet]:
}


@pytest.mark.parametrize("format_version", [DISCOVER, LATEST])
@pytest.mark.parametrize("descr_path,key", list(yield_valid_descr_paths()))
def test_example_descr_paths(
descr_path: Path,
key: str,
format_version: FormatVersionPlaceholder,
bioimageio_json_schema: Mapping[Any, Any],
):
check_bioimageio_yaml(
descr_path,
root=descr_path.parent,
as_latest=format_version == LATEST,
as_latest=False,
exclude_fields_from_roundtrip=EXCLUDE_FIELDS_FROM_ROUNDTRIP.get(key, set()),
bioimageio_json_schema=bioimageio_json_schema,
)
Expand Down

0 comments on commit e89bf57

Please sign in to comment.