Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occured Error When I execute export_graph method. #1071

Open
Don9wanKim opened this issue Feb 8, 2024 · 1 comment
Open

Occured Error When I execute export_graph method. #1071

Don9wanKim opened this issue Feb 8, 2024 · 1 comment

Comments

@Don9wanKim
Copy link

Don9wanKim commented Feb 8, 2024

I trained classification model based on Deverta architecture using transformers package.
And I converted onnx file with my model.
It was successful.
By the way, Error was occured When I save to tensorflow file using onnx file.
How can I convert to tf file using onnx file ?

My code is simple :

    tf_rep = prepare(onnx_model)    
    tf_rep.export_graph(TF_PATH)

Error is here

    File "/home/jovyan/Segmentation/onnx-tensorflow/onnx_tf/backend_tf_module.py", line 99, in __call__  *
        output_ops = self.backend._onnx_node_to_tensorflow_op(onnx_node,
    File "/home/jovyan/Segmentation/onnx-tensorflow/onnx_tf/backend.py", line 347, in _onnx_node_to_tensorflow_op  *
        return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
    File "/home/jovyan/Segmentation/onnx-tensorflow/onnx_tf/handlers/handler.py", line 59, in handle  *
        return ver_handle(node, **kwargs)
    File "/home/jovyan/Segmentation/onnx-tensorflow/onnx_tf/handlers/backend/gather_elements.py", line 71, in version_13  *
        return cls._common(node, **kwargs)
    File "/home/jovyan/Segmentation/onnx-tensorflow/onnx_tf/handlers/backend/gather_elements.py", line 41, in _common  *
        axis_perm = tf.tensor_scatter_nd_update(tf.range(tf.rank(data)),

    TypeError: Expected any non-tensor type, but got a tensor instead.

And I analized "gather_elements.py" file.

"tf.constant([axis, 0])" is the problem.
axis variable is "Tensor("Add_18:0", shape=(), dtype=int32)"

So, It was not complete convert to constant.
Let me know How can I this problem?...!

Python, ONNX, ONNX-TF, Tensorflow version

This section can be obtained by running get_version.py from util folder.

  • Python version: 3.8.12
  • ONNX version: 1.11.0
  • ONNX-TF version: 1.10.0
  • Tensorflow version: 2.13.0

Additional context
I added this PR When I install onnx-tf package.
Because "Squeeze" and "Unsqueeze" is not supported 13 version in the latest version.

Add any other context about the problem here.

@hanyswana
Copy link

Hi, I'm having the same trouble as you during the conversion from ONNX model to Tensorflow model. Can I know whether you have already solved this issue? Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants