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

2.3.0版本onnx转rknn错误 #251

Open
LiuFYv opened this issue Jan 7, 2025 · 0 comments
Open

2.3.0版本onnx转rknn错误 #251

LiuFYv opened this issue Jan 7, 2025 · 0 comments

Comments

@LiuFYv
Copy link

LiuFYv commented Jan 7, 2025

这是一个并非来自于官方zoo中的模型,在2.3.0版本中转换错误,在1.6.0中可以转换,但是对于1280的输入时1.6.0会报错:E RKNN: [10:01:26.811] REGTASK: The bit width of field value exceeds the limit, target: v2, offset: 0x5014, shift = 0, limit: 0x1fff, value: 0x31ff
尝试降级到1248可以正常转换

I rknn-toolkit2 version: 2.3.0
--> Config model
done
--> Loading model
W load_onnx: If you don't need to crop the model, don't set 'inputs'/'input_size_list'/'outputs'!
I Loading : 100%|██████████████████████████████████████████████| 224/224 [00:00<00:00, 24979.37it/s]
done
--> Building model
I OpFusing 0: 100%|██████████████████████████████████████████████| 100/100 [00:00<00:00, 326.05it/s]
I OpFusing 1 : 99%|█████████████████████████████████████████████▌| 99/100 [00:00<00:00, 244.36it/s]
W build: Show op fuse match nodes:
Rule: squeeze_1_in_nd_transpose
Subgraph:
Op type: Transpose
Op name: /model.24/Transpose
Input:
/model.24/Reshape_output_0 : [1, 3, 9, 160, 160]
Output:
/model.24/Transpose_output_0 : [1, 3, 160, 160, 9]
Attribute:
perm : [0, 1, 3, 4, 2]

W You can add disable_rules=['squeeze_1_in_nd_transpose'] in rknn.config() to temporarily disable the error rule!

E build: Traceback (most recent call last):
File "rknn/api/rknn_log.py", line 344, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_base.py", line 1962, in rknn.api.rknn_base.RKNNBase.build
File "rknn/api/graph_optimizer.py", line 2184, in rknn.api.graph_optimizer.GraphOptimizer.fuse_ops
File "rknn/api/ir_graph.py", line 537, in rknn.api.ir_graph.IRGraph.rebuild
File "rknn/api/ir_graph.py", line 311, in rknn.api.ir_graph.IRGraph._clean_model
File "rknn/api/ir_graph.py", line 125, in rknn.api.ir_graph.IRGraph.infer_shapes
File "rknn/api/ir_graph.py", line 138, in rknn.api.ir_graph.IRGraph.infer_shapes
File "rknn/base/extend_op/extend_op.py", line 192, in rknn.base.extend_op.extend_op.update_model_value_info
KeyError: '/model.6/m/m.0/Gather_output_0-rs'

W build: ===================== WARN(3) =====================
E rknn-toolkit2 version: 2.3.0
Traceback (most recent call last):
File "rknn/api/rknn_log.py", line 344, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_base.py", line 1962, in rknn.api.rknn_base.RKNNBase.build
File "rknn/api/graph_optimizer.py", line 2184, in rknn.api.graph_optimizer.GraphOptimizer.fuse_ops
File "rknn/api/ir_graph.py", line 537, in rknn.api.ir_graph.IRGraph.rebuild
File "rknn/api/ir_graph.py", line 311, in rknn.api.ir_graph.IRGraph._clean_model
File "rknn/api/ir_graph.py", line 125, in rknn.api.ir_graph.IRGraph.infer_shapes
File "rknn/api/ir_graph.py", line 138, in rknn.api.ir_graph.IRGraph.infer_shapes
File "rknn/base/extend_op/extend_op.py", line 192, in rknn.base.extend_op.extend_op.update_model_value_info
KeyError: '/model.6/m/m.0/Gather_output_0-rs'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/abc/moudle/YPLNet-main/yolov5-master/convert.py", line 61, in
ret = rknn.build(do_quantization=do_quant, dataset=DATASET_PATH)
File "/home/abc/anaconda3/envs/rknn2b0/lib/python3.9/site-packages/rknn/api/rknn.py", line 192, in build
return self.rknn_base.build(do_quantization=do_quantization, dataset=dataset, expand_batch_size=rknn_batch_size)
File "rknn/api/rknn_log.py", line 349, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_log.py", line 95, in rknn.api.rknn_log.RKNNLog.e
ValueError: Traceback (most recent call last):
File "rknn/api/rknn_log.py", line 344, in rknn.api.rknn_log.error_catch_decorator.error_catch_wrapper
File "rknn/api/rknn_base.py", line 1962, in rknn.api.rknn_base.RKNNBase.build
File "rknn/api/graph_optimizer.py", line 2184, in rknn.api.graph_optimizer.GraphOptimizer.fuse_ops
File "rknn/api/ir_graph.py", line 537, in rknn.api.ir_graph.IRGraph.rebuild
File "rknn/api/ir_graph.py", line 311, in rknn.api.ir_graph.IRGraph._clean_model
File "rknn/api/ir_graph.py", line 125, in rknn.api.ir_graph.IRGraph.infer_shapes
File "rknn/api/ir_graph.py", line 138, in rknn.api.ir_graph.IRGraph.infer_shapes
File "rknn/base/extend_op/extend_op.py", line 192, in rknn.base.extend_op.extend_op.update_model_value_info
KeyError: '/model.6/m/m.0/Gather_output_0-rs'

W __init__: rknn-toolkit2 version: 1.6.0+81f21f4d
--> Config model
done
--> Loading model
W load_onnx: If you don't need to crop the model, don't set 'inputs'/'input_size_list'/'outputs'!
W load_onnx: It is recommended onnx opset 19, but your onnx model opset is 12!
W load_onnx: Model converted from pytorch, 'opset_version' should be set 19 in torch.onnx.export for successful convert!
Loading : 100%|████████████████████████████████████████████████| 263/263 [00:00<00:00, 23057.67it/s]
done
--> Building model
GraphPreparing : 100%|██████████████████████████████████████████| 371/371 [00:00<00:00, 8076.56it/s]
Quantizating 1/2: 100%|███████████████████████████████████████████| 371/371 [00:07<00:00, 46.82it/s]
Quantizating 2/2: 100%|███████████████████████████████████████████| 371/371 [00:04<00:00, 77.19it/s]
W build: The default input dtype of 'images' is changed from 'float32' to 'int8' in rknn model for performance!
                       Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '/model.24/Transpose_output_0' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '/model.24/Transpose_1_output_0' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
W build: The default output dtype of '/model.24/Transpose_2_output_0' is changed from 'float32' to 'int8' in rknn model for performance!
                      Please take care of this change when deploy rknn model with Runtime API!
E RKNN: [10:01:26.811] REGTASK: The bit width of field value exceeds the limit, target: v2, offset: 0x5014, shift = 0, limit: 0x1fff, value: 0x31ff
done
--> Export rknn model
done
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

1 participant