microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.72k stars 2.94k forks source link

Dynamic Shape performance #10194

Open aitss2017 opened 2 years ago

aitss2017 commented 2 years ago

Describe the bug We want to compare static shape and dynamic shape performance difference for Bert model, but we measured similar number. Not sure it is correct.

Urgency Dynamic shape featute is key for NLP models, especially for bert series models

System information

To Reproduce

Expected behavior Some guide to measure dynamic and static shape performance difference

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.

tianleiwu commented 2 years ago

I think it is expected that you can get same performance for same input.

Dynamic shape only means the model is more flexible (can accept input of different shape). For BERT model with dynamic shape, we recommend to use transformer optimizer tool to get optimized model before inferencing.

aitss2017 commented 2 years ago

Thanks for your comment, Tianle! We have leverage such transformer optimizer.

Can we say that ORT would measure same performance for dynamic and static shape for all models besides Bert? Such as detection and image super resolution models, which would request dynamic shape support.

If yes, then can you help me understand how ORT solve such dynamic shape support? Such as memory allocation, kernel caching, etc.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.