diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 56dc6f2b..d5d5cf71 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 24.12.0 +current_version = 25.4.0 parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)?(?P\d+)?)? serialize = {year}.{month}.{number}{release} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfef6884..69fbc49b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,7 @@ jobs: auto-activate-base: false activate-environment: tiktorch-server-env environment-file: environment.yml + conda-remove-defaults: "true" channel-priority: strict miniforge-variant: Miniforge3 - name: Get the latest commit hash and target ref @@ -51,6 +52,7 @@ jobs: auto-activate-base: false activate-environment: tiktorch-server-env environment-file: environment.yml + conda-remove-defaults: "true" channel-priority: strict miniforge-variant: Miniforge3 - name: conda diagnostics @@ -89,6 +91,8 @@ jobs: with: auto-update-conda: true auto-activate-base: true + channels: conda-forge + conda-remove-defaults: "true" channel-priority: strict miniforge-variant: Miniforge3 - name: install common conda dependencies @@ -134,6 +138,7 @@ jobs: auto-update-conda: true auto-activate-base: true channel-priority: strict + conda-remove-defaults: "true" miniforge-variant: Miniforge3 - name: install common conda dependencies run: conda install -n base -c conda-forge conda-build setuptools_scm -y @@ -150,14 +155,14 @@ jobs: shell: bash -l {0} run: | conda build --test --override-channels \ - -c ./pkgs -c ilastik-forge -c pytorch -c conda-forge \ + -c ./pkgs -c pytorch -c conda-forge \ ./pkgs/noarch/${TIKTORCH_PACKAGE_NAME} - name: macOS Test if: matrix.os == 'macos-latest' shell: bash -l {0} run: | conda build --test --override-channels \ - -c ./pkgs -c ilastik-forge -c pytorch -c conda-forge \ + -c ./pkgs -c pytorch -c conda-forge \ ./pkgs/noarch/${TIKTORCH_PACKAGE_NAME} - name: Windows Test if: matrix.os == 'windows-latest' @@ -169,5 +174,5 @@ jobs: shell: cmd /C CALL {0} run: | conda build --test --override-channels ^ - -c %CD%\pkgs -c ilastik-forge -c pytorch -c conda-forge ^ + -c %CD%\pkgs -c pytorch -c conda-forge ^ .\pkgs\noarch\%TIKTORCH_PACKAGE_NAME% diff --git a/Makefile b/Makefile index a0c713d8..4b727883 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ version: devenv: . $$(conda info --base)/etc/profile.d/conda.sh - mamba env create --file environment.yml --name $(TIKTORCH_ENV_NAME) + conda env create --file environment.yml --name $(TIKTORCH_ENV_NAME) make install_submodules run_server: diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 47bbf538..5f71ec34 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -62,7 +62,6 @@ test: - pytest-grpc - pytest-timeout - cpuonly - - ilastik-pytorch-version-helper-cpu imports: # client - tiktorch diff --git a/environment.yml b/environment.yml index b15e0824..ae8a6c9a 100644 --- a/environment.yml +++ b/environment.yml @@ -1,9 +1,7 @@ name: tiktorch-server-env channels: - pytorch - - ilastik-forge - conda-forge - - nodefaults dependencies: # - bioimage.spec via submodule # - bioimage.core via submodule diff --git a/setup.py b/setup.py index a8e02b25..57e406bc 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="tiktorch", - version="24.12.0", + version="25.4.0", description="Tiktorch client/server", long_description=long_description, long_description_content_type="text/markdown", @@ -27,8 +27,8 @@ ], packages=find_packages(exclude=["tests"]), # Required install_requires=[ - "bioimageio.spec==0.5.3.3", - "bioimageio.core==0.6.10", + "bioimageio.spec", + "bioimageio.core==0.8.0", "grpcio>=1.31", "numpy<2", # pytorch 2.2.2-py3.9_0 for macos is compiled with numpy 1.* "protobuf", diff --git a/tests/conftest.py b/tests/conftest.py index 30beeb02..e427135f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -393,7 +393,9 @@ def _bioimage_model_siso_v4( model_descr = v0_4.ModelDescr( name="mocked v4 model", authors=[v0_4.Author(name="me")], - cite=[v0_4.CiteEntry(text="for model training see my paper", url=HttpUrl("https://doi.org/10.1234something"))], + cite=[ + v0_4.CiteEntry(text="for model training see my paper", url=HttpUrl("https://example.com/10.1234something")) + ], description="", inputs=[input_tensor], outputs=[output_tensor], diff --git a/tests/test_server/test_grpc/test_inference_servicer.py b/tests/test_server/test_grpc/test_inference_servicer.py index 363e03df..74916081 100644 --- a/tests/test_server/test_grpc/test_inference_servicer.py +++ b/tests/test_server/test_grpc/test_inference_servicer.py @@ -274,7 +274,6 @@ def test_call_predict_invalid_tensor_ids(self, grpc_stub, bioimage_model_explici ("channel", "batch", "x", "y"), ("time", "channel", "x", "y"), ("batch", "channel", "z", "y"), - ("b", "c", "x", "y"), ], ) def test_call_predict_invalid_axes(self, grpc_stub, axes, bioimage_model_explicit_add_one_siso_v5): diff --git a/tests/test_server/test_grpc/test_training_servicer.py b/tests/test_server/test_grpc/test_training_servicer.py index 741871a6..25d0a38e 100644 --- a/tests/test_server/test_grpc/test_training_servicer.py +++ b/tests/test_server/test_grpc/test_training_servicer.py @@ -508,10 +508,13 @@ def test_close_trainer_session_twice(self, grpc_stub): "dims, shape", [ ( - ("b", "c", "z", "y", "x"), + ("batch", "channel", "z", "y", "x"), (5, 3, 1, 128, 128), ), - (("b", "z", "y", "x", "c"), (5, 1, 128, 128, 3)), # order of input may be different than the one expected + ( + ("batch", "z", "y", "x", "channel"), + (5, 1, 128, 128, 3), + ), # order of input may be different than the one expected ], ) def test_forward_while_running(self, grpc_stub, dims, shape): @@ -534,7 +537,7 @@ def test_forward_while_running(self, grpc_stub, dims, shape): predicted_tensors = [pb_tensor_to_xarray(pb_tensor) for pb_tensor in response.tensors] assert len(predicted_tensors) == 1 predicted_tensor = predicted_tensors[0] - assert predicted_tensor.dims == ("b", "c", "z", "y", "x") + assert predicted_tensor.dims == ("batch", "channel", "z", "y", "x") out_channels_unet2d = 2 assert predicted_tensor.shape == (5, out_channels_unet2d, 1, 128, 128) @@ -550,7 +553,7 @@ def test_forward_while_paused(self, grpc_stub): out_channels_unet2d = 2 shape = (batch, in_channels_unet2d, 1, 128, 128) data = np.random.rand(*shape).astype(np.float32) - xarray_data = xr.DataArray(data, dims=("b", "c", "z", "y", "x")) + xarray_data = xr.DataArray(data, dims=("batch", "channel", "z", "y", "x")) pb_tensor = xarray_to_pb_tensor(tensor_id="input", array=xarray_data) predict_request = utils_pb2.PredictRequest(modelSessionId=training_session_id, tensors=[pb_tensor]) @@ -564,7 +567,7 @@ def test_forward_while_paused(self, grpc_stub): predicted_tensors = [pb_tensor_to_xarray(pb_tensor) for pb_tensor in response.tensors] assert len(predicted_tensors) == 1 predicted_tensor = predicted_tensors[0] - assert predicted_tensor.dims == ("b", "c", "z", "y", "x") + assert predicted_tensor.dims == ("batch", "channel", "z", "y", "x") assert predicted_tensor.shape == (batch, out_channels_unet2d, 1, 128, 128) def test_forward_invalid_dims(self, grpc_stub): diff --git a/tiktorch/trainer.py b/tiktorch/trainer.py index 1ab7551d..8b525cf8 100644 --- a/tiktorch/trainer.py +++ b/tiktorch/trainer.py @@ -433,13 +433,15 @@ def is_output_single_channel(self) -> bool: def _get_pytorch_tensor_from_bioimageio_tensor(self, bioimageio_tensor: bioimageio.core.Tensor) -> torch.Tensor: xr_array = bioimageio_tensor.data - expected_dims = {"b", "c", "z", "y", "x"} + expected_dims = {"batch", "channel", "z", "y", "x"} if set(xr_array.dims) != expected_dims: raise ValueError(f"Tensor dims should be {expected_dims}, but got {xr_array.dims}") - return torch.from_numpy(xr_array.transpose("b", "c", "z", "y", "x").values) + return torch.from_numpy(xr_array.transpose("batch", "channel", "z", "y", "x").values) def _get_bioimageio_tensor_from_pytorch_tensor(self, pytorch_tensor: torch.Tensor) -> bioimageio.core.Tensor: - return bioimageio.core.Tensor.from_xarray(xr.DataArray(pytorch_tensor.numpy(), dims=["b", "c", "z", "y", "x"])) + return bioimageio.core.Tensor.from_xarray( + xr.DataArray(pytorch_tensor.numpy(), dims=["batch", "channel", "z", "y", "x"]) + ) def should_stop(self) -> bool: """ diff --git a/vendor/core-bioimage-io-python b/vendor/core-bioimage-io-python index 878c6469..08b113c5 160000 --- a/vendor/core-bioimage-io-python +++ b/vendor/core-bioimage-io-python @@ -1 +1 @@ -Subproject commit 878c6469d6996298d95db815e2c5ae6a0db5ec3a +Subproject commit 08b113c510e4e5ddda5439876c947ae4a8d17e0e diff --git a/vendor/spec-bioimage-io b/vendor/spec-bioimage-io index af7ab2b1..93146f97 160000 --- a/vendor/spec-bioimage-io +++ b/vendor/spec-bioimage-io @@ -1 +1 @@ -Subproject commit af7ab2b102776352aca8f1488606d6def51cf5f8 +Subproject commit 93146f976a007b6e84994a9404698647b290e85a