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

多输入到底是怎么指定的,按照指定输入格式解析不出来 #206

Open
XiaBing992 opened this issue Jan 6, 2025 · 7 comments

Comments

@XiaBing992
Copy link

model_transform
--model_name transformer
--model_def ./transformer_layer_0.onnx
--dynamic_shape_input_names 'seq_len', 'sum_leq_len', 'last_seq_len'
--input_shapes [['seq_len',1,4096],[1,1,'seq_len','sum_leq_len'],['seq_len',1,32,2], ['last_seq_len',1,2,128], ['last_seq_len',1,2,128]]
--mlir transformer.mlir

image

@taytay-swift
Copy link

你好哥们,貌似在onnx转milr的情况上它不支持动态输入,比如我的模型是float32[DynamicDimension.0,8,3,320,320],我只能把他更改他的输入成[1,8,3,320,320],其中的1代替掉动态输入

@taytay-swift
Copy link

然后吧 估计这就是为什么bmodel的案例中,输入批次都是固定的,比如说bitch=1,bitch=4,我怀疑tpu就不支持动态输入

@taytay-swift
Copy link

包括tpu-mlir都没有说怎么指定onnx输入为动态

@XiaBing992
Copy link
Author

你好哥们,貌似在onnx转milr的情况上它不支持动态输入,比如我的模型是float32[DynamicDimension.0,8,3,320,320],我只能把他更改他的输入成[1,8,3,320,320],其中的1代替掉动态输入
我试过固定shape,也是一样的

@taytay-swift
Copy link

taytay-swift commented Jan 19, 2025

你的

--dynamic_shape_input_names 'seq_len', 'sum_leq_len', 'last_seq_len'
--input_shapes [['seq_len',1,4096],[1,1,'seq_len','sum_leq_len'],['seq_len',1,32,2], ['last_seq_len',1,2,128], ['last_seq_len',1,2,128]]

这部分 我翻过源码,我看到他的参数是支持的,但是貌似不是在onnx到mlir上用的

@taytay-swift
Copy link

或者

parser.add_argument("--dynamic", action='store_true',
                    help='only valid for onnx model. if set, will automatically set inputs with dyanmic axis \
                        as dynamic_shape_input_names and set 1-d inputs as shape_influencing_input_names')

你考虑一下在你的参数后面加上 --dynamic 打开动态输入

@taytay-swift
Copy link

但是我觉得大概率会寄,因为我那时候的模型的输入是float32[DynamicDimension.0,8,3,320,320]我指定了dynamic_shape_input_names为DynamicDimension.0,参数后带了dynamic也不行

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