Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 24.12.0
current_version = 25.4.0
parse = (?P<year>\d+)\.(?P<month>\d+)\.(?P<number>\d+)((?P<release>[a-z]+)?(?P<build>\d+)?)?
serialize =
{year}.{month}.{number}{release}
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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%
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ test:
- pytest-grpc
- pytest-timeout
- cpuonly
- ilastik-pytorch-version-helper-cpu
imports:
# client
- tiktorch
Expand Down
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: tiktorch-server-env
channels:
- pytorch
- ilastik-forge
- conda-forge
- nodefaults
dependencies:
# - bioimage.spec via submodule
# - bioimage.core via submodule
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
1 change: 0 additions & 1 deletion tests/test_server/test_grpc/test_inference_servicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
13 changes: 8 additions & 5 deletions tests/test_server/test_grpc/test_training_servicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)

Expand All @@ -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])

Expand All @@ -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):
Expand Down
8 changes: 5 additions & 3 deletions tiktorch/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,15 @@

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"}

Check warning on line 436 in tiktorch/trainer.py

View check run for this annotation

Codecov / codecov/patch

tiktorch/trainer.py#L436

Added line #L436 was not covered by tests
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)

Check warning on line 439 in tiktorch/trainer.py

View check run for this annotation

Codecov / codecov/patch

tiktorch/trainer.py#L439

Added line #L439 was not covered by tests

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(

Check warning on line 442 in tiktorch/trainer.py

View check run for this annotation

Codecov / codecov/patch

tiktorch/trainer.py#L442

Added line #L442 was not covered by tests
xr.DataArray(pytorch_tensor.numpy(), dims=["batch", "channel", "z", "y", "x"])
)

def should_stop(self) -> bool:
"""
Expand Down
2 changes: 1 addition & 1 deletion vendor/core-bioimage-io-python
Submodule core-bioimage-io-python updated 94 files
+267 −105 .github/workflows/build.yaml
+1 −1 .github/workflows/draft-release.yml
+0 −75 .github/workflows/release.yml
+6 −0 .gitignore
+1 −1 .pre-commit-config.yaml
+78 −60 README.md
+1 −1 bioimageio/core/VERSION
+99 −28 bioimageio/core/__init__.py
+1 −1 bioimageio/core/__main__.py
+70 −50 bioimageio/core/_prediction_pipeline.py
+586 −144 bioimageio/core/_resource_tests.py
+2 −1 bioimageio/core/_settings.py
+22 −8 bioimageio/core/axis.py
+3 −0 bioimageio/core/backends/__init__.py
+245 −0 bioimageio/core/backends/_model_adapter.py
+18 −35 bioimageio/core/backends/keras_backend.py
+53 −0 bioimageio/core/backends/onnx_backend.py
+180 −0 bioimageio/core/backends/pytorch_backend.py
+212 −0 bioimageio/core/backends/tensorflow_backend.py
+74 −0 bioimageio/core/backends/torchscript_backend.py
+25 −14 bioimageio/core/block_meta.py
+335 −92 bioimageio/core/cli.py
+47 −84 bioimageio/core/commands.py
+23 −0 bioimageio/core/common.py
+1 −1 bioimageio/core/dataset.py
+119 −77 bioimageio/core/digest_spec.py
+221 −32 bioimageio/core/io.py
+22 −0 bioimageio/core/model_adapters.py
+0 −3 bioimageio/core/model_adapters/__init__.py
+0 −177 bioimageio/core/model_adapters/_model_adapter.py
+0 −71 bioimageio/core/model_adapters/_onnx_model_adapter.py
+0 −153 bioimageio/core/model_adapters/_pytorch_model_adapter.py
+0 −275 bioimageio/core/model_adapters/_tensorflow_model_adapter.py
+0 −96 bioimageio/core/model_adapters/_torchscript_model_adapter.py
+55 −55 bioimageio/core/prediction.py
+59 −30 bioimageio/core/proc_ops.py
+93 −63 bioimageio/core/proc_setup.py
+26 −11 bioimageio/core/sample.py
+25 −7 bioimageio/core/stat_calculators.py
+49 −24 bioimageio/core/tensor.py
+2 −0 bioimageio/core/utils/__init__.py
+30 −0 bioimageio/core/utils/_compare.py
+0 −28 bioimageio/core/utils/testing.py
+0 −1 bioimageio/core/weight_converter/__init__.py
+0 −1 bioimageio/core/weight_converter/keras/__init__.py
+0 −151 bioimageio/core/weight_converter/keras/_tensorflow.py
+0 −1 bioimageio/core/weight_converter/torch/__init__.py
+0 −108 bioimageio/core/weight_converter/torch/_onnx.py
+0 −146 bioimageio/core/weight_converter/torch/_torchscript.py
+0 −24 bioimageio/core/weight_converter/torch/_utils.py
+3 −0 bioimageio/core/weight_converters/__init__.py
+173 −0 bioimageio/core/weight_converters/_add_weights.py
+15 −0 bioimageio/core/weight_converters/_utils_onnx.py
+183 −0 bioimageio/core/weight_converters/keras_to_tensorflow.py
+79 −0 bioimageio/core/weight_converters/pytorch_to_onnx.py
+70 −0 bioimageio/core/weight_converters/pytorch_to_torchscript.py
+84 −0 bioimageio/core/weight_converters/torchscript_to_onnx.py
+14 −11 dev/env-dev.yaml
+49 −0 dev/env-full.yaml
+52 −0 dev/env-gpu.yaml
+14 −11 dev/env-py38.yaml
+0 −42 dev/env-tf.yaml
+0 −41 dev/env-wo-python.yaml
+15 −7 example/model_usage.ipynb
+819 −0 presentations/create_ambitious_sloth.ipynb
+11,433 −0 presentations/create_ambitious_sloth.slides.html
+23 −4 pyproject.toml
+25 −0 scripts/pdoc/create_pydantic_patch.sh
+28 −0 scripts/pdoc/mark_pydantic_attrs_private.patch
+16 −0 scripts/pdoc/run.sh
+2 −2 scripts/show_diff.py
+33 −26 setup.py
+0 −0 tests/__init__.py
+58 −53 tests/conftest.py
+0 −0 tests/test_add_weights.py
+1 −1 tests/test_any_model_fixture.py
+114 −0 tests/test_bioimageio_collection.py
+9 −18 tests/test_bioimageio_spec_version.py
+23 −2 tests/test_cli.py
+44 −0 tests/test_commands.py
+11 −11 tests/test_digest_spec.py
+38 −0 tests/test_io.py
+127 −228 tests/test_prediction.py
+5 −2 tests/test_prediction_pipeline.py
+5 −23 tests/test_prediction_pipeline_device_management.py
+38 −35 tests/test_proc_ops.py
+4 −9 tests/test_resource_tests.py
+44 −6 tests/test_stat_calculators.py
+30 −4 tests/test_tensor.py
+108 −0 tests/test_weight_converters.py
+21 −0 tests/utils.py
+0 −52 tests/weight_converter/keras/test_tensorflow.py
+0 −18 tests/weight_converter/torch/test_onnx.py
+0 −22 tests/weight_converter/torch/test_torchscript.py
2 changes: 1 addition & 1 deletion vendor/spec-bioimage-io
Submodule spec-bioimage-io updated 123 files
Loading