docs: add external data file handling section to PyTorch export tuto…#28764
Open
CandyButcher27 wants to merge 2 commits into
Open
docs: add external data file handling section to PyTorch export tuto…#28764CandyButcher27 wants to merge 2 commits into
CandyButcher27 wants to merge 2 commits into
Conversation
Author
|
@microsoft-github-policy-service agree |
xadupre
reviewed
Jun 3, 2026
| ```python | ||
| import onnx | ||
|
|
||
| model = onnx.load("model.onnx", load_external_data=True) |
Member
There was a problem hiding this comment.
@copilot what do you recommend for files > 2Gb? (not supported by protobuf)
Split the section into two options: - Option A: models < 2GB can be merged into a single .onnx file - Option B: models >= 2GB must be deployed as a file pair (protobuf limit) Addresses reviewer feedback that merging is not possible for large models.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #28763
Description
Added a new section "Handling External Data Files (Large Models)" to the PyTorch export tutorial.
Documents a common production gotcha: exporting large PyTorch models with opset 17+ automatically splits the output into
model.onnx+model.onnx.data.InferenceSessionfails if the.datafile is missing.Also documents how to merge the split files into a single self-contained
.onnxfile for distribution using theonnxlibrary.Motivation and Context
This gap trips up anyone exporting modern PyTorch models for CPU deployment. Neither the Python inference tutorial nor the PyTorch export tutorial mentioned this behavior. Discovered while deploying an EfficientNet-B2 model exported with PyTorch 2.12 + opset 17.