(tfjs) ➜ ~ tensorflowjs_converter \
--input_format=tf_hub \
'https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/1' \
./test
Loading the module using TF 1.X interface from /var/folders/63/ffmcnx4933gbk9z_7fllm2zw0000gn/T/tfhub_modules/cc14ad57953629a2bbc0ffe52de5afb5518150b2.
WARNING:tensorflow:From /anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py:3632: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING: Logging before flag parsing goes to stderr.
W0810 00:45:09.462952 4726969792 deprecation.py:323] From /anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/control_flow_ops.py:3632: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
2019-08-10 00:45:12.864207: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2019-08-10 00:45:12.882761: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 4. Tune using inter_op_parallelism_threads for best performance.
Creating a model with inputs ['images'] and outputs ['module_apply_default/MobilenetV1/Logits/SpatialSqueeze'].
WARNING:tensorflow:From /anaconda3/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py:385: 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
W0810 00:45:14.082165 4726969792 deprecation.py:323] From /anaconda3/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py:385: 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 /anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py:245: 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
W0810 00:45:14.082515 4726969792 deprecation.py:323] From /anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/graph_util_impl.py:245: 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 "/anaconda3/bin/tensorflowjs_converter", line 10, in <module>
sys.exit(main())
File "/anaconda3/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 597, in main
strip_debug_ops=FLAGS.strip_debug_ops)
File "/anaconda3/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 430, in convert_tf_hub_module
quantization_dtype, skip_op_check, strip_debug_ops)
File "/anaconda3/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 397, in convert_tf_hub_module_v1
graph=graph)
File "/anaconda3/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 140, in optimize_graph
graph_def=graph_def, graph=graph)
File "/anaconda3/lib/python3.7/site-packages/tensorflow/python/training/saver.py", line 1546, in export_meta_graph
raise RuntimeError("Exporting/importing meta graphs is not supported when "
RuntimeError: Exporting/importing meta graphs is not supported when eager execution is enabled. No graph exists when eager execution is enabled
$ pip freeze > log
tb-nightly==1.14.0a20190301
tensorboard==1.14.0
tensorflow==2.0.0a0
tensorflow-estimator==1.14.0
tensorflow-estimator-2.0-preview==1.14.0.dev2019080900
tensorflow-hub==0.5.0
tensorflowjs==1.2.6
termcolor==1.1.0
tf-estimator-nightly==1.14.0.dev2019030115
tf-nightly-2.0-preview==2.0.0.dev20190808
When I use tfjs-converter, I had tried in TF 1.14.1, 2.0.0b, a version. but not work.
@graykode Unfortunately you cannot use Hub modules with eager mode at this point of time. We are working on TF2 support, including Eager mode, in time for the TF2.0 release (not preview). Sorry for the inconvenience. Similar #124
@gowthamkpr Is it worked on TF 1.x?..
Hi Tae-Hwan,
the tfjs converter should support both old hub modules and new SavedModel 2.0.
Please note:
tensorflowjs 1.2.6 has requirement tensorflow==1.14.0, but you'll have tensorflow 2.0.0a0 which is incompatible.
Still the command you gave works for me at:
tensorflow==2.0.0a0
tensorflowjs==1.2.6
tensorflow-hub==0.5.0
Can you try a clean install, with something like:
pip uninstall tensorflow tensorflow_hub tensorflowjs
pip install tensorflow==2.0.0a0 tensorflow_hub==0.5.0 tensorflowjs==1.2.6
@graykode Did you try clean install as recommended by @vbardiovskyg ? Are you still facing the issue?
@gowthamkpr No It's working now! I think.. it was some tfjs dependency twist in my Mac.. Thanks for helping I'll close this issue.
tensorflow==2.0.0a0 tensorflow_hub==0.5.0 tensorflowjs==1.2.6: Doesn't work for me. Got the same error
import tensorflow.compat.v1 as tf
#To make tf 2.0 compatible with tf1.0 code, we disable the tf2.0 functionalities
tf.disable_eager_execution()
This helps.
@vishalmhjn a small change in the code ,it's changed from tf.disable_eager_execution() to tf.compat.v1.disable_eager_execution()
import tensorflow.compat.v1 as tf
#To make tf 2.0 compatible with tf1.0 code, we disable the tf2.0 functionalities
tf.disable_eager_execution()This helps.
It works for me. Thank you.
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
in all the py files fixed this eager execution meta graphs, variable_scope, and reset graph errors from some old v1 tensorflow code.
`
import tensorflow.compat.v1 as tf
import tensorflow_hub as hub
tf.compat.v1.disable_eager_execution()
embed = hub.Module(r"D:\nlp\model")
`
it works for me
you can also use tf.compat.v1.disable_v2_behavior() to stop all tensorflow2 behaviours.
import tensorflow.compat.v1 as tf
#To make tf 2.0 compatible with tf1.0 code, we disable the tf2.0 functionalities
tf.disable_eager_execution()
This helps.It works for me. Thank you.
also works for me!
Most helpful comment
import tensorflow.compat.v1 as tf#To make tf 2.0 compatible with tf1.0 code, we disable the tf2.0 functionalitiestf.disable_eager_execution()This helps.