I tried to use Tensorflow tutorial with the latest TVM
built from source with LLVM and tensorflow-1.15
I got the following error
Exception: Couldn't find ANTLR parser. Try building with USE_ANTLR=ON.
Full output:
root@164895bae70c:~# python3 from_tensorflow.py
File /root/.tvm_test_data/data/elephant-299.jpg exists, skip.
File /root/.tvm_test_data/tf/InceptionV1/classify_image_graph_def-with_shapes.pb exists, skip.
File /root/.tvm_test_data/data/imagenet_2012_challenge_label_map_proto.pbtxt exists, skip.
File /root/.tvm_test_data/data/imagenet_synset_to_human_label_map.txt exists, skip.
WARNING:tensorflow:From from_tensorflow.py:92: FastGFile.__init__ (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.gfile.GFile.
WARNING:tensorflow:From from_tensorflow.py:93: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.
2019-10-29 18:58:40.311461: W tensorflow/core/framework/op_def_util.cc:357] Op BatchNormWithGlobalNormalization is deprecated. It will cease to work in GraphDef version 9. Use tf.nn.batch_normalization().
WARNING:tensorflow:From from_tensorflow.py:99: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
2019-10-29 18:58:40.419274: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2019-10-29 18:58:40.419337: E tensorflow/stream_executor/cuda/cuda_driver.cc:318] failed call to cuInit: UNKNOWN ERROR (303)
2019-10-29 18:58:40.419389: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (164895bae70c): /proc/driver/nvidia/version does not exist
2019-10-29 18:58:40.419751: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-10-29 18:58:40.442045: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3192000000 Hz
2019-10-29 18:58:40.443908: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x72c93a0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2019-10-29 18:58:40.443964: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
WARNING:tensorflow:From /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/testing/tf.py:86: 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 /usr/local/lib/python3.7/dist-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`
[18:58:40] /root/tvm/src/relay/ir/module.cc:286: Importing: /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/std/prelude.rly
Traceback (most recent call last):
File "from_tensorflow.py", line 129, in <module>
shape=shape_dict)
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/tensorflow.py", line 2484, in from_tensorflow
g = GraphProto()
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/frontend/tensorflow.py", line 1965, in __init__
self._prelude = Prelude(self._mod)
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/prelude.py", line 533, in __init__
self.load_prelude()
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/prelude.py", line 549, in load_prelude
self.mod.import_from_std("prelude.rly")
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/module.py", line 239, in import_from_std
return _module.Module_ImportFromStd(self, file_to_import)
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/_ctypes/function.py", line 207, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (5) /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(TVMFuncCall+0x63) [0x7f0f40339573]
[bt] (4) /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(+0xc8e425) [0x7f0f4022e425]
[bt] (3) /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(tvm::relay::ModuleNode::ImportFromStd(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x189) [0x7f0f4022e259]
[bt] (2) /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(tvm::relay::ModuleNode::Import(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x3c7) [0x7f0f4022df17]
[bt] (1) /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(tvm::relay::FromText(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0xf7) [0x7f0f40227ae7]
[bt] (0) /usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/libtvm.so(+0x42075d) [0x7f0f3f9c075d]
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/_parser.py", line 38, in <module>
from .grammar.py3.RelayVisitor import RelayVisitor
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/_ffi/_ctypes/function.py", line 72, in cfun
rv = local_pyfunc(*pyargs)
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/parser.py", line 25, in fromtext
from tvm.relay import _parser
File "/usr/local/lib/python3.7/dist-packages/tvm-0.6.dev0-py3.7-linux-x86_64.egg/tvm/relay/_parser.py", line 42, in <module>
raise Exception("Couldn't find ANTLR parser. Try building with USE_ANTLR=ON.")
ModuleNotFoundError: No module named 'tvm.relay.grammar.py3'
During handling of the above exception, another exception occurred:
Exception: Couldn't find ANTLR parser. Try building with USE_ANTLR=ON.
ANTLR needs Java. Do I really need to have Java and build TVM with ANTLR in order to compile tensorflow models?