-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Fix bug with saving model optimized by inference session #16716
Merged
kunal-vaishnavi
merged 11 commits into
microsoft:main
from
kunal-vaishnavi:kvaishnavi/fix-optimizer-temp-dir
Jul 21, 2023
Merged
Fix bug with saving model optimized by inference session #16716
kunal-vaishnavi
merged 11 commits into
microsoft:main
from
kunal-vaishnavi:kvaishnavi/fix-optimizer-temp-dir
Jul 21, 2023
Conversation
This file contains 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
tianleiwu
reviewed
Jul 14, 2023
tianleiwu
reviewed
Jul 15, 2023
tianleiwu
reviewed
Jul 15, 2023
tianleiwu
reviewed
Jul 19, 2023
tianleiwu
approved these changes
Jul 20, 2023
justinchuby
reviewed
Jul 21, 2023
kunal-vaishnavi
added a commit
that referenced
this pull request
Jul 31, 2023
### Description This PR adds support for saving model optimizations after loading a model that contains external data into an `InferenceSession`. ### Motivation and Context This PR is a follow-up to a [previous PR](#16716) for saving a model optimized by an `InferenceSession`.
jchen351
pushed a commit
that referenced
this pull request
Aug 12, 2023
### Description A [previous PR](#16531) added a temporary directory to save the model optimizations after loading a model into an `InferenceSession`. Many models that have an external data file, however, require the data file to be in the same directory as the ONNX model file. Because the model is saved in a temporary directory and the data is saved in another directory, this causes a `FileNotFoundError` error when trying to load the model in the temporary directory. This PR fixes this error by saving the external data file in the same directory that the optimized model is located in. ### Motivation and Context This PR fixes a bug with using a temporary directory while running the optimizer for models that have an external data file.
jchen351
pushed a commit
that referenced
this pull request
Aug 12, 2023
### Description This PR adds support for saving model optimizations after loading a model that contains external data into an `InferenceSession`. ### Motivation and Context This PR is a follow-up to a [previous PR](#16716) for saving a model optimized by an `InferenceSession`.
5 tasks
guotuofeng
added a commit
to microsoft/Olive
that referenced
this pull request
Aug 25, 2023
## Describe your changes In onnxruntime, the following PRs will make the optimize_model save external data in the temporary folder * microsoft/onnxruntime#16531 * microsoft/onnxruntime#16716 * microsoft/onnxruntime#16912 So, in 1.16.0 afterwards, we don't need to copy the model to a temp directory ## Checklist before requesting a review - [ ] Add unit tests for this change. - [ ] Make sure all tests can pass. - [ ] Update documents if necessary. - [ ] Format your code by running `pre-commit run --all-files` - [ ] Is this a user-facing change? If yes, give a description of this change to be included in the release notes. ## (Optional) Issue link
kleiti
pushed a commit
to kleiti/onnxruntime
that referenced
this pull request
Mar 22, 2024
### Description This PR adds support for saving model optimizations after loading a model that contains external data into an `InferenceSession`. ### Motivation and Context This PR is a follow-up to a [previous PR](microsoft#16716) for saving a model optimized by an `InferenceSession`.
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.
Description
A previous PR added a temporary directory to save the model optimizations after loading a model into an
InferenceSession
. Many models that have an external data file, however, require the data file to be in the same directory as the ONNX model file. Because the model is saved in a temporary directory and the data is saved in another directory, this causes aFileNotFoundError
error when trying to load the model in the temporary directory.This PR fixes this error by saving the external data file in the same directory that the optimized model is located in.
Motivation and Context
This PR fixes a bug with using a temporary directory while running the optimizer for models that have an external data file.