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

Fix(BMZ): Relax model output validation kwargs; extract weights and config file following new spec and core release #279

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 10 additions & 0 deletions src/careamics/model_io/bioimage/model_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ def create_model_description(
"https://careamics.github.io/latest/",
],
license="BSD-3-Clause",
config={
"bioimageio": {
"test_kwargs": {
"pytorch_state_dict": {
"absolute_tolerance": 1e-2,
"relative_tolerance": 1e-2,
}
}
}
},
version="0.1.0",
weights=weights_descr,
attachments=[FileDescr(source=config_path)],
Expand Down
7 changes: 6 additions & 1 deletion src/careamics/model_io/bmz_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ def export_to_bmz(
)

# test model description
summary: ValidationSummary = test_model(model_description)
test_kwargs = (
model_description.config.get("bioimageio", {})
.get("test_kwargs", {})
.get("pytorch_state_dict", {})
)
summary: ValidationSummary = test_model(model_description, **test_kwargs)
if summary.status == "failed":
raise ValueError(f"Model description test failed: {summary}")

Expand Down
Loading