onnx / onnx-tensorflow

Tensorflow Backend for ONNX
Other
1.28k stars 297 forks source link

Error while importing in Raspberry Pi #469

Open hossein1387 opened 5 years ago

hossein1387 commented 5 years ago

Describe the bug I installed onnx-tf on both Raspberry pi (32 bit ARMv7 Processor) using the following command:

pip install onnx-tf==1.3.0

However, when I try to imort the module in python, I get the following errors.

In Raspberry Pi:

>>> import onnx_tf
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
  return f(*args, **kwds)
/usr/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
  return f(*args, **kwds)
/usr/local/lib/python3.5/dist-packages/onnx_tf/common/__init__.py:87: UserWarning: onnx_tf.common.get_outputs_names is deprecated. It will be removed in future release. Use TensorflowGraph.get_outputs_names instead.
  warnings.warn(message)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/dist-packages/onnx_tf/__init__.py", line 1, in <module>
    from . import backend
  File "/usr/local/lib/python3.5/dist-packages/onnx_tf/backend.py", line 28, in <module>
    from onnx_tf.common.handler_helper import get_all_backend_handlers
  File "/usr/local/lib/python3.5/dist-packages/onnx_tf/common/handler_helper.py", line 5, in <module>
    from onnx_tf.handlers.backend import *  # noqa
  File "/usr/local/lib/python3.5/dist-packages/onnx_tf/handlers/backend/hardmax.py", line 10, in <module>
    @tf_func(tf.contrib.seq2seq.hardmax)
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/python/util/lazy_loader.py", line 61, in __getattr__
    module = self._load()
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/python/util/lazy_loader.py", line 44, in _load
    module = importlib.import_module(self.__name__)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/contrib/__init__.py", line 40, in <module>
    from tensorflow.contrib import distribute
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/contrib/distribute/__init__.py", line 33, in <module>
    from tensorflow.contrib.distribute.python.tpu_strategy import TPUStrategy
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/contrib/distribute/python/tpu_strategy.py", line 27, in <module>
    from tensorflow.contrib.tpu.python.ops import tpu_ops
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/contrib/tpu/__init__.py", line 69, in <module>
    from tensorflow.contrib.tpu.python.ops.tpu_ops import *
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/contrib/tpu/python/ops/tpu_ops.py", line 39, in <module>
    resource_loader.get_path_to_datafile("_tpu_ops.so"))
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/contrib/util/loader.py", line 56, in load_op_library
    ret = load_library.load_op_library(path)
  File "/home/hossein/.local/lib/python3.5/site-packages/tensorflow/python/framework/load_library.py", line 61, in load_op_library
    lib_handle = py_tf.TF_LoadLibrary(library_filename)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Invalid name: 
An op that loads optimization parameters into HBM for embedding. Must be
preceded by a ConfigureTPUEmbeddingHost op that sets up the correct
embedding table configuration. For example, this op is used to install
parameters that are loaded from a checkpoint before a training loop is
executed.
...
chinhuang007 commented 5 years ago

Okay, finally got around to try this out. I am using a pi 4, with onnx=1.5.0, tensorflow=1.13.1, onnx-tf=1.3.0, python=3.7.3. It works fine with the sample mobilenetv2-1.0 onnx file from https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.tar.gz, able to run prepare and export to a tensorflow pb file. Your error seems related to Tensorflow. Can you re-install Tensorflow (not the gpu version) and see if it helps?