From 4200c1937f230dc7b4a8e7744d3792126840ee86 Mon Sep 17 00:00:00 2001 From: Adam Cogdell <17283933+BlaziusMaximus@users.noreply.github.com> Date: Thu, 10 Nov 2022 13:28:25 -0800 Subject: [PATCH 1/2] Change dependency from saved_model_cli to saved_model_utils --- .../tensorflowjs/converters/tf_saved_model_conversion_v2.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py b/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py index 9fa80b2759b..e7ffa39e104 100644 --- a/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py +++ b/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py @@ -43,8 +43,8 @@ from tensorflow.python.keras.saving.saving_utils import model_input_signature from tensorflow.python.saved_model.load import load from tensorflow.python.saved_model import loader +from tensorflow.python.tools import saved_model_utils from tensorflow.python.training.saver import export_meta_graph -from tensorflow.python.tools.saved_model_cli import get_signature_def_map from tensorflow.saved_model.experimental import TrackableResource from google.protobuf.json_format import MessageToDict import tensorflow_hub as hub @@ -640,7 +640,9 @@ def _load_model(saved_model_dir, saved_model_tags): return model def _find_signature(saved_model_dir, saved_model_tags, signature_def): - signature_def_map = get_signature_def_map(saved_model_dir, saved_model_tags) + meta_graph = saved_model_utils.get_meta_graph_def(saved_model_dir, + saved_model_tags) + signature_def_map = meta_graph.signature_def if signature_def not in signature_def_map.keys(): raise ValueError('Signature "%s" does not exist in the saved model' % (signature_def)) From 62821fb9eba6d1f202e4589070939d03d63c7cc8 Mon Sep 17 00:00:00 2001 From: Adam Cogdell <17283933+BlaziusMaximus@users.noreply.github.com> Date: Mon, 21 Nov 2022 17:18:57 -0800 Subject: [PATCH 2/2] saved_model_utils import change --- .../tensorflowjs/converters/tf_saved_model_conversion_v2.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py b/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py index e7ffa39e104..2d11244941c 100644 --- a/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py +++ b/tfjs-converter/python/tensorflowjs/converters/tf_saved_model_conversion_v2.py @@ -43,7 +43,7 @@ from tensorflow.python.keras.saving.saving_utils import model_input_signature from tensorflow.python.saved_model.load import load from tensorflow.python.saved_model import loader -from tensorflow.python.tools import saved_model_utils +from tensorflow.python.tools.saved_model_utils import get_meta_graph_def from tensorflow.python.training.saver import export_meta_graph from tensorflow.saved_model.experimental import TrackableResource from google.protobuf.json_format import MessageToDict @@ -640,8 +640,7 @@ def _load_model(saved_model_dir, saved_model_tags): return model def _find_signature(saved_model_dir, saved_model_tags, signature_def): - meta_graph = saved_model_utils.get_meta_graph_def(saved_model_dir, - saved_model_tags) + meta_graph = get_meta_graph_def(saved_model_dir, saved_model_tags) signature_def_map = meta_graph.signature_def if signature_def not in signature_def_map.keys(): raise ValueError('Signature "%s" does not exist in the saved model'