converter: ValueError: Unsupported Ops in the model before optimization
To get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.
TensorFlow.js version
-- @tensorflow/[email protected]
+-- @tensorflow/[email protected]
+-- @tensorflow/[email protected]
| +-- @types/[email protected]
| +-- @types/[email protected]
| +-- @types/[email protected]
| +-- @types/[email protected]
| +-- [email protected]
| -- [email protected]
+-- @tensorflow/[email protected]
| +-- @types/[email protected]
| | +-- @types/[email protected]
| | -- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | -- [email protected]
| | -- [email protected]
| | -- [email protected]
| -- [email protected] deduped
-- @tensorflow/[email protected]
Browser version
Describe the problem or feature request
Code to reproduce the bug / link to feature request
If you would like to get help from the community, we encourage using Stack Overflow and the tensorflow.js tag.
I save a linear estimator as follow
linear_est.export_saved_model(
"./model/", serving_input_fn)
with the result
INFO:tensorflow:Calling model_fn.
INFO:tensorflow:Done calling model_fn.
INFO:tensorflow:Signatures INCLUDED in export for Classify: ['serving_default', 'classification']
INFO:tensorflow:Signatures INCLUDED in export for Regress: ['regression']
INFO:tensorflow:Signatures INCLUDED in export for Predict: ['predict']
INFO:tensorflow:Signatures INCLUDED in export for Train: None
INFO:tensorflow:Signatures INCLUDED in export for Eval: None
INFO:tensorflow:Restoring parameters from C:\Users\nibur\AppData\Local\Temp\tmpvn9274v2\model.ckpt-9384
INFO:tensorflow:Assets added to graph.
INFO:tensorflow:No assets to write.
INFO:tensorflow:SavedModel written to: ./model\temp-1588619275\saved_model.pb
When I then try to convert this model to tfjs I got the following error
`(venv) PS C:\predict\web> tensorflowjs_wizard Welcome to TensorFlow.js Converter. ? Please provide the path of model file or the directory that contains model files. If you are converting TFHub module please provide the URL. sold\model\1588619275\saved_model.pb ? What is your input model format? (auto-detected format is marked with *) Tensorflow Saved Model * ? What is tags for the saved model? serve ? What is signature name of the model? signature name: predict ? Do you want to compress the model? (this will decrease the model precision.) No compression (Higher accuracy) ? Please enter shard size (in bytes) of the weight files? 4194304 ? Do you want to skip op validation? This will allow conversion of unsupported ops, you can implement them as custom ops in tfjs-converter. No ? Do you want to strip debug ops? This will improve model execution performance. Yes ? Which directory do you want to save the converted model in? web ? The output already directory exists, do you want to overwrite it? Yes converter command generated: tensorflowjs_converter --input_format=tf_saved_model --saved_model_tags=serve --signature_name=predict --strip_debug_ops=True --weight_shard_size_bytes=4194304 sold\model\1588619275 web
2020-05-07 10:25:23.621058: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py:1786: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
WARNING:tensorflow:Issue encountered when serializing global_step.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
to_proto not supported in EAGER mode.
WARNING:tensorflow:Issue encountered when serializing variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
to_proto not supported in EAGER mode.
WARNING:tensorflow:Issue encountered when serializing trainable_variables.
Type is unsupported, or the types of the items don't match field type in CollectionDef. Note this is a warning and probably safe to ignore.
to_proto not supported in EAGER mode.
2020-05-07 10:25:24.401911: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)
2020-05-07 10:25:24.412308: E tensorflow/core/grappler/grappler_item_builder.cc:656] Init node linear/linear_model/linear/linear_model/linear/linear_model/category_id/category_id_lookup/hash_table/table_init/LookupTableImportV2 doesn't exist in graph
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py:313: load (from tensorflow.python.saved_model.loader_impl) is deprecated and will be removed in a future version.
Instructions for updating:
This function will only be available through the v1 compatibility library as tf.compat.v1.saved_model.loader.load or tf.compat.v1.saved_model.load. There will be a new function for importing SavedModels in Tensorflow 2.0.
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py:315: convert_variables_to_constants (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.convert_variables_to_constants
WARNING:tensorflow:From c:\predict\web\venv\lib\site-packages\tensorflow_core\python\framework\graph_util_impl.py:277: extract_sub_graph (from tensorflow.python.framework.graph_util_impl) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.compat.v1.graph_util.extract_sub_graph
Conversion failed, please check error log file C:\Users\nibur\AppData\Local\Temp\converter_error.log.
(venv) PS C:\predict\web> python --version
Python 3.6.8`
This is the related log file
Traceback (most recent call last):
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\wizard.py", line 562, in run
converter.convert(arguments)
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\converter.py", line 618, in convert
weight_shard_size_bytes=weight_shard_size_bytes)
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 462, in convert_tf_saved_model
weight_shard_size_bytes=weight_shard_size_bytes)
File "c:\predict\web\venv\lib\site-packages\tensorflowjs\converters\tf_saved_model_conversion_v2.py", line 142, in optimize_graph
', '.join(unsupported))
ValueError: Unsupported Ops in the model before optimization
ParseExampleV2, Unique, HashTableV2, SparseReshape, LookupTableFindV2, AsString, SparseFillEmptyRows, SparseSegmentSum
Here is the saved model model.zip
GitHub issues for this repository are tracked in the tfjs union repository.
Please file your issue there, following the guidance in that issue template.
Those ops are not supported in tfjs and there is no roadmap as of now to support them.