Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update adapters and converters #440

Draft
wants to merge 115 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
fbbfc57
Fix weight converters and return their corresponding v5 weight descr
thodkatz Aug 15, 2024
a37b568
Create an interface for weight conversion
thodkatz Aug 15, 2024
db891eb
fix import_callable annotation
FynnBe Dec 2, 2024
a391d94
improve error traceback for single weights format attempt
FynnBe Dec 2, 2024
4103b51
add load_state
FynnBe Dec 2, 2024
7ec7afb
update ONNXModelAdapter
FynnBe Dec 2, 2024
ed8f1db
update TorchscriptModelAdapter typing
FynnBe Dec 2, 2024
9ae626d
update unzipping in tensorflow model adapter
FynnBe Dec 3, 2024
fceed3c
add upper bounds to dependencies
FynnBe Dec 3, 2024
77e1e84
update dev envs
FynnBe Dec 3, 2024
a131369
WIP setup run expensive tests
FynnBe Dec 3, 2024
0888c52
WIP resource tests
FynnBe Dec 3, 2024
40dfe25
expose sha256 arg
FynnBe Dec 3, 2024
bb539d4
update torchscript adapter
FynnBe Dec 4, 2024
fedd43c
bump spec lib version
FynnBe Dec 4, 2024
b7d5f98
Merge remote-tracking branch 'thodkatz/weight-converters' into fix_to…
FynnBe Dec 4, 2024
7f6fdf1
WIP refactor backend libs
FynnBe Dec 5, 2024
7fea808
add summary_path arg
FynnBe Dec 5, 2024
4564f7c
update annotation
FynnBe Dec 5, 2024
00e6ba1
fix tf seeding
FynnBe Dec 5, 2024
5d1e2ce
expose test_description_in_conda_env
FynnBe Dec 5, 2024
df36d15
docstring formatting
FynnBe Dec 5, 2024
376507f
absorb test_description_in_conda_env into test_description
FynnBe Dec 6, 2024
a8a50ec
Merge branch 'install_conda_envs' into fix_torch_load
FynnBe Dec 6, 2024
9690574
all model adapters in backends
FynnBe Dec 6, 2024
f52a894
sort tests
FynnBe Dec 6, 2024
523c54b
add create_model_adapter
FynnBe Dec 9, 2024
d438a12
pin pyright
FynnBe Dec 9, 2024
f9a1a67
continue refactor of weight converters and backends
FynnBe Dec 9, 2024
80f9ed0
update test_weight_converters.py
FynnBe Dec 9, 2024
dad8186
add test_bioimageio_collection.py
FynnBe Dec 9, 2024
e835432
add onnx as dev dep
FynnBe Dec 9, 2024
459696d
add get_pre_and_postprocessing
FynnBe Dec 10, 2024
169cf17
use dim instead of deprecated dims arg name
FynnBe Dec 10, 2024
7d8e7fc
update tests
FynnBe Dec 11, 2024
8b2727e
add todo
FynnBe Dec 11, 2024
02252ac
udpate pytorch_to_onnx converter
FynnBe Dec 11, 2024
ab8616f
expose determinism to cli test command
FynnBe Dec 18, 2024
f11b428
WIP unify model adapters
FynnBe Dec 18, 2024
e5bbe7a
fix TorchscriptModelAdapter
FynnBe Dec 19, 2024
3720e85
update predict_sample_without_blocking
FynnBe Dec 19, 2024
76c27e9
ensure batch and channel axes have standardized id
FynnBe Dec 19, 2024
4cbfc5a
support validation context 'raise_errors'
FynnBe Dec 20, 2024
447409f
fix ONNXModelAdapter
FynnBe Dec 20, 2024
3b514f8
_get_axis_type ->_guess_axis_type
FynnBe Dec 20, 2024
b264331
fix get_axes_infos
FynnBe Dec 20, 2024
84f24fe
bump pyright version
FynnBe Dec 20, 2024
27ea9aa
add test cases
FynnBe Dec 20, 2024
de759d5
fix pip install with no-deps
FynnBe Jan 7, 2025
d5abcfc
don't ignore model.v0_4.ScaleLinearKwargs with axes not implemented
FynnBe Jan 10, 2025
c64ff1b
fix keras and tf backends
FynnBe Jan 13, 2025
852e8b1
use AxisBase instead
FynnBe Jan 14, 2025
4299a8c
remove TooFewDevicesException exception
FynnBe Jan 15, 2025
3009f5b
improve test_mean_var_std_calculator
FynnBe Jan 15, 2025
b6f84f9
annotate relative and absolute tolerance
FynnBe Jan 24, 2025
b09d389
add check_reproducibility
FynnBe Jan 24, 2025
e35735d
add imagecodecs dependency
FynnBe Jan 24, 2025
34d5478
improve increase_available_weight_formats
FynnBe Jan 24, 2025
cfa3713
make docstring test os independent
FynnBe Jan 27, 2025
b4e76d1
return Tensor instead of np.ndarray
FynnBe Jan 27, 2025
43438d9
append to conv report
FynnBe Jan 27, 2025
bf7494e
avoid loguru logger in conftest.py to avoid error messages by pytest-…
FynnBe Jan 27, 2025
c99c89a
add todo and docstrings
FynnBe Feb 3, 2025
8c61d69
update typing
FynnBe Feb 3, 2025
666e80c
fix stats for absence of batch axis
FynnBe Feb 3, 2025
0d01271
split test_mean_var_std_calculator
FynnBe Feb 3, 2025
489d04e
default_ns -> blocksize_paramter and update docstrings
FynnBe Feb 5, 2025
f970c6b
deprecate tolerance arguments
FynnBe Feb 5, 2025
c775546
sort Tensor methods and add argmax() and item()
FynnBe Feb 5, 2025
05af735
remove decimal argument
FynnBe Feb 5, 2025
0d97bf3
update conda test build
FynnBe Feb 6, 2025
d13067e
remove decimal cli arg
FynnBe Feb 6, 2025
d3599f3
fix mismatched elements per million
FynnBe Feb 6, 2025
c171ab0
fix axis id conversion
FynnBe Feb 7, 2025
8d76a81
add UpdateFormatCmd
FynnBe Feb 7, 2025
cb47733
fix load_torch_model
FynnBe Feb 7, 2025
6a6d6a2
add logging to increase_available_weight_formats
FynnBe Feb 7, 2025
ee310fa
bump polite-pig
FynnBe Feb 7, 2025
19e2092
do not use pytest-xdist for cleaner test logs
FynnBe Feb 7, 2025
6ec6451
use summary.display() for nicer test logs
FynnBe Feb 7, 2025
0d113c2
avoid unnecessary imports in enable_determinism
FynnBe Feb 7, 2025
01c0fbd
add default args to enable_determinism
FynnBe Feb 7, 2025
e5f0efd
rename UpdateFormatCmd path arg to output
FynnBe Feb 7, 2025
961503d
enable_determinsm for all tests
FynnBe Feb 7, 2025
9f0cf83
use common EXAMPLE_DESCRIPTIONS URL
FynnBe Feb 7, 2025
01eb0fd
rename IncreaseWeightFormatsCmd arg path to output
FynnBe Feb 7, 2025
cf6f9ee
improve weights converters
FynnBe Feb 20, 2025
e6bd24b
Separates pipeline build logic per version
Tomaz-Vieira Feb 20, 2025
73f4dba
Factors out common code from pipeline setup funcs
Tomaz-Vieira Feb 20, 2025
8919900
Apllies black
Tomaz-Vieira Feb 20, 2025
aa22fef
make loading pytorch weights safe
FynnBe Feb 21, 2025
adbb976
accept single tensor source
FynnBe Feb 21, 2025
2d0d189
make sure to perform io checks
FynnBe Feb 21, 2025
f6fff61
better logging in CLI
FynnBe Feb 24, 2025
d3787a5
image io with PermissiveFileSource
FynnBe Feb 24, 2025
f01ee3d
fix predict_many and improve save_sample
FynnBe Feb 24, 2025
bd784e0
remove markdown dep (needed in spec)
FynnBe Feb 24, 2025
03d4940
bump pyright
FynnBe Feb 24, 2025
fc3a03f
Merge remote-tracking branch 'Tomaz-Vieira/fix_v4_pre_and_post_proces…
FynnBe Feb 24, 2025
89d7466
replace get_proc_class with get_proc
FynnBe Feb 24, 2025
67fa607
use overload for 'latest'
FynnBe Feb 25, 2025
667eeac
ensure 0.4 models get float32 inputa
FynnBe Feb 25, 2025
ddf86fc
log block shape
FynnBe Feb 25, 2025
3298944
add shape attribute
FynnBe Feb 25, 2025
70fb627
add TODO exclude default values
FynnBe Feb 26, 2025
503c04b
add exclude_defaults arg
FynnBe Feb 26, 2025
ed6d158
add update-hashes command
FynnBe Feb 27, 2025
b652258
update unet2d_diff_output_shape example and add cli tests
FynnBe Feb 28, 2025
4affce2
log output path
FynnBe Mar 3, 2025
e97686c
unify cmd naming pattern
FynnBe Mar 3, 2025
a2fefeb
limit converters to latest format
FynnBe Mar 3, 2025
5185936
update tests
FynnBe Mar 3, 2025
c310947
alaways zip converted tf weights
FynnBe Mar 3, 2025
5563e92
add epsilon
FynnBe Mar 3, 2025
fe15700
move test_model imports
FynnBe Mar 3, 2025
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
Prev Previous commit
Next Next commit
WIP resource tests
FynnBe committed Dec 3, 2024
commit 0888c52049ab62a271d9bd0291fbd61edc577382
60 changes: 60 additions & 0 deletions bioimageio/core/test_bioimageio_collection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from typing import Any, Collection, Dict, Iterable, Mapping, Tuple

import pytest
import requests
from pydantic import HttpUrl

from bioimageio.spec import InvalidDescr
from bioimageio.spec.common import Sha256
from tests.utils import ParameterSet, expensive_test

BASE_URL = "https://uk1s3.embassy.ebi.ac.uk/public-datasets/bioimage.io/"


def _get_latest_rdf_sources():
entries: Any = requests.get(BASE_URL + "all_versions.json").json()["entries"]
ret: Dict[str, Tuple[HttpUrl, Sha256]] = {}
for entry in entries:
version = entry["versions"][0]
ret[f"{entry['concept']}/{version['v']}"] = (
HttpUrl(version["source"]),
Sha256(version["sha256"]),
)

return ret


ALL_LATEST_RDF_SOURCES: Mapping[str, Tuple[HttpUrl, Sha256]] = _get_latest_rdf_sources()


def yield_bioimageio_yaml_urls() -> Iterable[ParameterSet]:
for descr_url, sha in ALL_LATEST_RDF_SOURCES.values():
key = (
str(descr_url)
.replace(BASE_URL, "")
.replace("/files/rdf.yaml", "")
.replace("/files/bioimageio.yaml", "")
)
yield pytest.param(descr_url, sha, key, id=key)


KNOWN_INVALID: Collection[str] = set()


@expensive_test
@pytest.mark.parametrize("descr_url,sha,key", list(yield_bioimageio_yaml_urls()))
def test_rdf(
descr_url: HttpUrl,
sha: Sha256,
key: str,
):
if key in KNOWN_INVALID:
pytest.skip("known failure")

from bioimageio.core import load_description_and_test

descr = load_description_and_test(descr_url, sha256=sha)
assert not isinstance(descr, InvalidDescr)
assert (
descr.validation_summary.status == "passed"
), descr.validation_summary.format()
3 changes: 0 additions & 3 deletions bioimageio/core/test_collection.py

This file was deleted.

7 changes: 6 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import os
from functools import wraps
from typing import Any, Protocol, Type
from typing import Any, Protocol, Sequence, Type

import pytest


class ParameterSet(Protocol):
def __init__(self, values: Sequence[Any], marks: Any, id: str) -> None:
super().__init__()


class test_func(Protocol):
def __call__(*args: Any, **kwargs: Any): ...