bug(converter): fails to convert model
See original GitHub issueTensorFlow.js version
- tensorflowjs 2.0.1.post1
- tensorflow 2.2.0
Browser version
(Converter, no browser)
Describe the problem or feature request
tensorflowjs_converter
fails to convert simple tensorflow model.
Code to reproduce the bug / link to feature request
Python model:
import tensorflow as tf
import numpy as np
# Create model
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dropout(0.5))
model.add(tf.keras.layers.LSTM(64, return_sequences=True, stateful=True))
model.add(tf.keras.layers.Dense(2))
model.build(input_shape=(1, 1, 25))
model.summary()
# Assume I fit the model
# model.fit(cool_data)
model.predict(np.random.randn(1, 1, 25)) # Set input shapes
# Save model
model.save("model")
Convert to tensorflow.js
:
tensorflowjs_converter --input_format=tf_saved_model model web_model
(I also tried using the wizard, and other command variants)
Console output:
2020-07-04 17:12:26.010596: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-04 17:12:26.022300: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2199900000 Hz
2020-07-04 17:12:26.028111: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55ed517829b0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-04 17:12:26.028153: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-07-04 17:12:27.130305: 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-07-04 17:12:27.130427: I tensorflow/core/grappler/clusters/single_machine.cc:356] Starting new session
2020-07-04 17:12:27.153298: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:797] Optimization results for grappler item: graph_to_optimize
2020-07-04 17:12:27.153357: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:799] function_optimizer: Graph size after: 248 nodes (240), 428 edges (420), time = 8.011ms.
2020-07-04 17:12:27.153370: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:799] function_optimizer: function_optimizer did nothing. time = 0.109ms.
WARNING:tensorflow:From /home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py:340: 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 /home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py:342: 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 /home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py:359: 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`
Traceback (most recent call last):
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 482, in convert_tf_saved_model
frozen_graph = _freeze_saved_model_v2(concrete_func, control_flow_v2)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 352, in _freeze_saved_model_v2
concrete_func, lower_control_flow=not control_flow_v2).graph
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/framework/convert_to_constants.py", line 679, in convert_variables_to_constants_v2
func, lower_control_flow, aggressive_inlining)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/framework/convert_to_constants.py", line 526, in _convert_variables_to_constants_v2_impl
raise ValueError("Cannot find the Placeholder op that is an input "
ValueError: Cannot find the Placeholder op that is an input to the ReadVariableOp.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/nlp/amit/anaconda2/envs/meta-scholar/bin/tensorflowjs_converter", line 8, in <module>
sys.exit(pip_main())
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 735, in pip_main
main([' '.join(sys.argv[1:])])
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 739, in main
convert(argv[0].split(' '))
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 681, in convert
control_flow_v2=args.control_flow_v2)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 485, in convert_tf_saved_model
output_node_names)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 342, in _freeze_saved_model_v1
sess, g.as_graph_def(), output_node_names)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 359, in convert_variables_to_constants
inference_graph = extract_sub_graph(input_graph_def, output_node_names)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 205, in extract_sub_graph
_assert_nodes_are_present(name_to_node, dest_nodes)
File "/home/nlp/amit/anaconda2/envs/meta-scholar/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py", line 160, in _assert_nodes_are_present
assert d in name_to_node, "%s is not in graph" % d
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
How to Troubleshoot a DC-DC Buck Converter
Problem #1: Too Much Ripple Other problems could be C out too low (not enough storage to hold up the output) or C...
Read more >Common Mistakes in DC/DC Converters and How to Fix Them
The buck converter is the most widely used. DC/DC converter topology in point-of-load (POL) switching regulators. It is a simple and effective mechanism...
Read more >Troubleshooting Buck converter output spikes - YouTube
Buck converters, spikes, hands on, ceramic capacitors, inductor capacitance, SRF, noise, EMI.
Read more >Negative Resistance and Why Your Dc-Dc Converter May Not ...
The issue may be basic; the converter is not plugged in, the power is not turned on, or the input fuse is blown....
Read more >DC to DC Buck Converter Tutorial & Diagram - Analog Devices
When the circuit output voltage changes, VERROR also changes and thus causes the comparator threshold to change. Consequently, the output pulse width (PWM)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@AmitMY This looks like a TensorFlow internal error, investigating it with Keras team, please stay tuned.
@caisq Thanks for the help, @AmitMY i am glad you got this working!