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

How to delete the Range operator node in ONNX export #1878

Open
Buer-Chen opened this issue Feb 19, 2025 · 5 comments
Open

How to delete the Range operator node in ONNX export #1878

Buer-Chen opened this issue Feb 19, 2025 · 5 comments

Comments

@Buer-Chen
Copy link

Description:

We noticed that in the process of exporting the PyTorch model to the ONNX format, the generated ONNX model contains a Range operator. The locations of these nodes are basically like /encoder//encoder//self _ attn _ weights/Range. What part of the code may cause this problem, and how can I modify it to prevent the range operator from appearing in the exported onnx model?
The model export code used is: icefall/egs/librispeech/ASR/zipformer/export-onnx.py
We would appreciate any insights or suggestions on this matter.

@csukuangfj
Copy link
Collaborator

csukuangfj commented Feb 19, 2025

like /encoder//encoder//self _ attn _ weights/Range.

Can you post screenshots for it?

What is the issue of having such an operator in ONNX?

@Buer-Chen
Copy link
Author

like /encoder//encoder//self _ attn _ weights/Range.

Can you post screenshots for it?

What is the issue of having such an operator in ONNX?
Sure, here is the screenshots:

Image

I want to convert it to rknn model. But rknn-tookit2 do not support the range operator

@csukuangfj
Copy link
Collaborator

which version of rknn-toolkit2 are you using?

have you tried 2.1.0 or above?

@csukuangfj
Copy link
Collaborator

or are you still using 1.6.0?

@Buer-Chen
Copy link
Author

Buer-Chen commented Feb 20, 2025

or are you still using 1.6.0?

I tried 2.3.0 and 2.1.0 versions of the tool chain, and both of them encountered this problem. I just looked up the given encoder model in rknn_model_zoo and found that their fp32 model is fixed-length and the derived model has no Range operator, but the int8 model is dynamic-length and contains Range operator. Converting their fp32 model can be converted normally, but the int8 model will encounter the same problem.
The model I converted is our own fine-tuned English model, and the example given by RK is Chinese model. The model given is zipformerv1, and I need to use zipformerv2.

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