|
3 | 3 | from bioimageio.core import load_raw_resource_description, load_resource_description
|
4 | 4 | from bioimageio.core.resource_io import nodes
|
5 | 5 | from bioimageio.core.resource_io.utils import resolve_source
|
| 6 | +from bioimageio.core.resource_tests import test_model as _test_model |
6 | 7 | from marshmallow import missing
|
7 | 8 |
|
8 | 9 |
|
@@ -81,17 +82,19 @@ def _test_build_spec(
|
81 | 82 | output_path=out_path,
|
82 | 83 | add_deepimagej_config=add_deepimagej_config,
|
83 | 84 | maintainers=[{"github_user": "jane_doe"}],
|
| 85 | + input_names=[inp.name for inp in model_spec.inputs], |
| 86 | + output_names=[out.name for out in model_spec.outputs], |
84 | 87 | )
|
85 | 88 | if architecture is not None:
|
86 | 89 | kwargs["architecture"] = architecture
|
87 | 90 | if model_kwargs is not None:
|
88 |
| - kwargs["kwargs"] = model_kwargs |
| 91 | + kwargs["model_kwargs"] = model_kwargs |
89 | 92 | if tensorflow_version is not None:
|
90 | 93 | kwargs["tensorflow_version"] = tensorflow_version
|
91 | 94 | if opset_version is not None:
|
92 | 95 | kwargs["opset_version"] = opset_version
|
93 | 96 | if use_implicit_output_shape:
|
94 |
| - kwargs["input_name"] = ["input"] |
| 97 | + kwargs["input_names"] = ["input"] |
95 | 98 | kwargs["output_reference"] = ["input"]
|
96 | 99 | kwargs["output_scale"] = [[1.0, 1.0, 1.0, 1.0]]
|
97 | 100 | kwargs["output_offset"] = [[0.0, 0.0, 0.0, 0.0]]
|
@@ -134,6 +137,10 @@ def _test_build_spec(
|
134 | 137 | assert attachments.files is not missing
|
135 | 138 | assert n_processing == len(attachments.files)
|
136 | 139 |
|
| 140 | + # test inference for the model to ensure that the weights were written correctly |
| 141 | + test_res = _test_model(out_path) |
| 142 | + assert test_res["error"] is None |
| 143 | + |
137 | 144 |
|
138 | 145 | def test_build_spec_pytorch(any_torch_model, tmp_path):
|
139 | 146 | _test_build_spec(any_torch_model, tmp_path / "model.zip", "pytorch_state_dict")
|
|
0 commit comments