ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
Find a file
Frank Dong c5b6be045f
enable serialize prepacked weights into data file (#22256)
### Description
part of https://github.com/microsoft/onnxruntime/issues/21448
This change is intend to save CPU memory during model load for
inference.
Added session option save_prepacked_constant_initializers, with
save_prepacked_constant_initializers turn on:
1. optimize model with inference session, prepacked external initializer
will be saved into data file.
2. load optimized model and external data file with prepacked
initializer, no prepack is needed
3. run inference with optimized model and data file

Tested with model Phi-3-mini-instruct-onnx,
with ORT 1.12.0:

![image](https://github.com/user-attachments/assets/3c0337be-f340-4bb7-8f9f-30f3552072ef)

with this change:

![image](https://github.com/user-attachments/assets/23282990-2e1e-4a1f-92de-afa8ed7e6a43)

Peak memory usage dropped from **5.438 GB to 2.726GB**.
This change takes advantage of ORT loads external initializer with mmap
on CPU. Prepack will use extra memory on heap, omit prepack process can
save this part of memory (roughly same size as external initializers).

next step:
Change all the kernels on CPU with PrePack method implemented and test
properly. Will do in next PR.



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
2024-10-24 22:24:48 -07:00
.config
.devcontainer
.gdn
.github Enable Prefast for WebGPU native (#22588) 2024-10-24 19:10:00 -07:00
.pipelines
.vscode
cgmanifests Remove nsync (#20413) 2024-10-21 15:32:14 -07:00
cmake [JS/WebGPU] Support WASM64 (#21836) 2024-10-24 20:21:51 -07:00
csharp bumps up version in main from 1.20 -> 1.21 (#22482) 2024-10-17 12:32:35 -07:00
dockerfiles
docs Enable QLinearMatMul for opset21 (#22488) 2024-10-22 14:33:36 -07:00
include/onnxruntime/core enable serialize prepacked weights into data file (#22256) 2024-10-24 22:24:48 -07:00
java
js [JS/WebGPU] Support WASM64 (#21836) 2024-10-24 20:21:51 -07:00
objectivec
onnxruntime enable serialize prepacked weights into data file (#22256) 2024-10-24 22:24:48 -07:00
orttraining enable serialize prepacked weights into data file (#22256) 2024-10-24 22:24:48 -07:00
rust
samples
tools [JS/WebGPU] Support WASM64 (#21836) 2024-10-24 20:21:51 -07:00
winml
.clang-format
.clang-tidy
.dockerignore
.gitattributes
.gitignore
.gitmodules
.lintrunner.toml
build.bat
build.sh
build_arm64x.bat
CITATION.cff
CODEOWNERS
CONTRIBUTING.md
lgtm.yml
LICENSE
NuGet.config
ort.wprp
ORT_icon_for_light_bg.png
packages.config
pyproject.toml
README.md Update README.md with release roadmap info (#22486) 2024-10-18 11:00:43 -07:00
requirements-dev.txt
requirements-doc.txt
requirements-lintrunner.txt
requirements-training.txt
requirements.txt
SECURITY.md
setup.py
ThirdPartyNotices.txt Remove nsync (#20413) 2024-10-21 15:32:14 -07:00
VERSION_NUMBER bumps up version in main from 1.20 -> 1.21 (#22482) 2024-10-17 12:32:35 -07:00

ONNX Runtime is a cross-platform inference and training machine-learning accelerator.

ONNX Runtime inference can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. Learn more →

ONNX Runtime training can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. Learn more →

Get Started & Resources

Builtin Pipeline Status

System Inference Training
Windows Build Status
Build Status
Build Status
Linux Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Mac Build Status
Android Build Status
iOS Build Status
Web Build Status
Other Build Status

This project is tested with BrowserStack.

Third-party Pipeline Status

System Inference Training
Linux Build Status

Releases

The current release and past releases can be found here: https://github.com/microsoft/onnxruntime/releases.

For details on the upcoming release, including release dates, announcements, features, and guidance on submitting feature requests, please visit the release roadmap: https://onnxruntime.ai/roadmap.

Data/Telemetry

Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.

Contributions and Feedback

We welcome contributions! Please see the contribution guidelines.

For feature requests or bug reports, please file a GitHub Issue.

For general discussion or questions, please use GitHub Discussions.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

This project is licensed under the MIT License.