Improve the compatibility dealing with large ONNX proto in ORTOptimizer and ORTQuantizer#332
Conversation
…ace/optimum into add_onnx_export_options
|
The documentation is not available anymore as the PR was closed or merged. |
…ace/optimum into add_onnx_export_options
regisss
left a comment
There was a problem hiding this comment.
Thanks for this PR @JingyaHuang!!
I just have one comment which may be unrelated to this PR.
JingyaHuang
left a comment
There was a problem hiding this comment.
Thanks for reviewing, I will put the arguments in ORTModel as suggested and make necessary changes in the examples.
|
Moved config(model and ORT) saving after saving the model, otherwise will get the following error as configs are saved in the folder: While running the template example, I got the error message in the evaluation phase(no problem with the optimization, and models with external files are properly saved): Seems like a bug with the metric, an update might need to be done with the examples. I can take it over if you don't have bandwidth @echarlaix. |
What does this PR do?
all_tensors_to_one_fileoption toORTOptimizerwhen exporting the ONNX model.P.S. only the ONNXModel of optimization has added the option, not quantization.
ORTOptimizerandORTQuantizerin cases of large ONNX proto(export path / load ONNX)Fixes #222
Related to onnx/onnx#4394
P.S.
ORTOptimizerwould better cache the original model as theORTQuantizer, this PR will not target the issue, it could be done either in the refactorization PR ORT optimizer refactorization #294 or in a new PR.save_as_external_data,all_tensors_to_one_file,size_threshold(1024),convert_attribute(false), and the last two are not supported to be self-defined in onnxruntime yet. But in general, the first two are the most effective.ONNXModel.save_model_to_fileof quantization and optimization microsoft/onnxruntime#12576