Skip to content

Commit 1dc5d3f

Browse files
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent f804cb3 commit 1dc5d3f

File tree

7 files changed

+11
-15
lines changed

7 files changed

+11
-15
lines changed

bioimageio/core/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,9 @@ def convert_keras_weights_to_tensorflow(
267267
ret_code = keras_converter.convert_weights_to_tensorflow_saved_model_bundle(model_rdf, output_path)
268268
sys.exit(ret_code)
269269

270-
convert_keras_weights_to_tensorflow.__doc__ =\
270+
convert_keras_weights_to_tensorflow.__doc__ = (
271271
keras_converter.convert_weights_to_tensorflow_saved_model_bundle.__doc__
272+
)
272273

273274

274275
if __name__ == "__main__":

bioimageio/core/build_spec/build_model.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _get_weights(
8686
model_kwargs=None,
8787
tensorflow_version=None,
8888
opset_version=None,
89-
**kwargs
89+
**kwargs,
9090
):
9191
weight_path = resolve_source(original_weight_source, root)
9292
if weight_type is None:
@@ -769,8 +769,7 @@ def add_weights(
769769
opset_version: Optional[str] = None,
770770
**weight_kwargs,
771771
):
772-
"""Add weight entry to bioimage.io model.
773-
"""
772+
"""Add weight entry to bioimage.io model."""
774773
# we need to pass the weight path as abs path to avoid confusion with different root directories
775774
new_weights, tmp_arch = _get_weights(
776775
Path(weight_uri).absolute(),

bioimageio/core/prediction_pipeline/_model_adapters/_keras_model_adapter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
try:
66
from tensorflow import keras
77
import tensorflow as tf
8+
89
TF_VERSION = tf.__version__
910
except Exception:
1011
import keras
12+
1113
TF_VERSION = None
1214
import xarray as xr
1315

bioimageio/core/weight_converter/keras/tensorflow.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def _convert_tf1(keras_weight_path, output_path, zip_weights):
2020

2121
builder = saved_model.builder.SavedModelBuilder(output_path)
2222
signature = saved_model.signature_def_utils.predict_signature_def(
23-
inputs={'input': keras_model.input}, outputs={'output': keras_model.output}
23+
inputs={"input": keras_model.input}, outputs={"output": keras_model.output}
2424
)
2525

2626
signature_def_map = {saved_model.signature_constants.DEFAULT_SERVING_SIGNATURE_DEF_KEY: signature}
2727

28-
builder.add_meta_graph_and_variables(keras.backend.get_session(),
29-
[saved_model.tag_constants.SERVING],
30-
signature_def_map=signature_def_map)
28+
builder.add_meta_graph_and_variables(
29+
keras.backend.get_session(), [saved_model.tag_constants.SERVING], signature_def_map=signature_def_map
30+
)
3131
builder.save()
3232

3333
if zip_weights:

tests/conftest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ def unet2d_multi_tensor_or_not(request):
200200
return pytest.model_packages[request.param]
201201

202202

203-
@pytest.fixture(
204-
params=[] if skip_keras else ["unet2d_keras"]
205-
)
203+
@pytest.fixture(params=[] if skip_keras else ["unet2d_keras"])
206204
def unet2d_keras(request):
207205
return pytest.model_packages[request.param]

tests/weight_converter/keras/test_tensorflow.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
def test_tensorflow_converter(any_keras_model, tmp_path):
42
from bioimageio.core.weight_converter.keras import convert_weights_to_tensorflow_saved_model_bundle
53

tests/weight_converter/torch/test_torchscript.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
def test_torchscript_converter(any_torch_model, tmp_path):
42
from bioimageio.core.weight_converter.torch import convert_weights_to_pytorch_script
53

0 commit comments

Comments
 (0)