Hi,
We’re calling SavedModelBundle.exporter("/data/").withSession(sess).withSignature(mySig).export
to save a model. It seems to save out fine (according to the cli tool). But when we’re loading it from the Python side using tf.saved_model.load("/data/")
, we’re getting the following error in ValueError: Feeds must be tensors
.
Any ideas ?
more details…
Signature (according to saved_model_cli
)
The given SavedModel SignatureDef contains the following input(s):
inputs['_input_0'] tensor_info:
dtype: DT_FLOAT
shape: (10)
name: Placeholder_1:0
The given SavedModel SignatureDef contains the following output(s):
outputs['_out_0'] tensor_info:
dtype: DT_FLOAT
shape: (10)
name: Relu_1:0
Method name is:
And full python stacktrace
wrap_function.py.prune(/apps/python3/lib/python3.7/site-packages/tensorflow/python/eager/wrap_function.py:262)
load_v1_in_v2.py._extract_saver_restore(/apps/python3/lib/python3.7/site-packages/tensorflow/python/saved_model/load_v1_in_v2.py:105)
load_v1_in_v2.py.load(/apps/python3/lib/python3.7/site-packages/tensorflow/python/saved_model/load_v1_in_v2.py:211)
load_v1_in_v2.py.load(/apps/python3/lib/python3.7/site-packages/tensorflow/python/saved_model/load_v1_in_v2.py:263)
load.py.load_internal(/apps/python3/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py:613)
load.py.load(/apps/python3/lib/python3.7/site-packages/tensorflow/python/saved_model/load.py:578)
What version of TF-Java exported the model, and what version of TF Python is loading it in?
It’s a little weird it’s coming in as a TF v1 model, we might need to set a bit somewhere to have it load using the appropriate path.
We’re exporting from the latest nightly of TF-Java. And loading into Python TF 2.2
Just to clarify, there is no nightly build for TF-Java, so I guess you mean the latest version of the 0.4.0 snapshot?
One thing to check would be to see if it loads into TF Python 2.5 as that’s the version of the native TF library that is in TF-Java 0.4.0-SNAPSHOT at the moment. I’m not sure how good TF’s compatibility is for loading in saved models from the future.
Yes, sorry. Meant 0.4.0-SNAPSHOT
Just tried in TF 2.6 (loading from Python side). And getting same error + stacktrace.
Ok, I can replicate this using a simple CNN model I trained in TF-Java 0.3.1 and TF Python 2.6.0. Guess we’ll need to trace through the Python code and figure out what it is looking for.
1 Like
@Aish_Fenton , were you able to complete successfully this process of loading in Python a model that has been trained and saved in Java with a previous version of TF Java? If so, which version was that?
No, we’ve only started playing with TF-Java since 0.4.0-SNAPSHOT
.
I may have found the problem, see this comment. Looks like Python is more sensitive on how to pass the path of a tensor in the SaverDef
.
Hi @Aish_Fenton , please note that this bug should be now fixed in the version 0.3.3 that has just been released and I’ve merged the fix to the current snapshot as well.
Let us know if you are still facing this or other issues, thank you
Karl
1 Like