Skip to content

Conversation

tonypottera24
Copy link
Contributor

Description

  1. Check model.ByteSize() to decide whether to use infer_shapes_path or infer_shapes.
  2. Check model.ByteSize() to decide whether to use save_as_external_data on onnx.save.

Note that if save_as_external_data=False, the following check_model may fail.

Motivation and Context

Current extract_model function does not support models larger than 2GB.
For example, issue #6368 is caused by large models like an UNet.
This PR improves the existing function by checking the size of the model.

Signed-off-by: Po-Chu Hsu <tonypottera@gmail.com>
@tonypottera24 tonypottera24 requested a review from a team as a code owner October 9, 2024 06:23
@tonypottera24 tonypottera24 changed the title support models larger than 2G Support models larger than 2G Oct 9, 2024
@tonypottera24 tonypottera24 changed the title Support models larger than 2G Support models larger than 2GB Oct 9, 2024
Copy link

codecov bot commented Oct 9, 2024

Codecov Report

Attention: Patch coverage is 30.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 57.24%. Comparing base (5f8717c) to head (e86ac5e).
Report is 306 commits behind head on main.

Files with missing lines Patch % Lines
onnx/utils.py 30.00% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6438      +/-   ##
==========================================
- Coverage   57.26%   57.24%   -0.02%     
==========================================
  Files         507      507              
  Lines       31432    31438       +6     
  Branches     3540     3542       +2     
==========================================
  Hits        17998    17998              
- Misses      12590    12594       +4     
- Partials      844      846       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Po-Chu Hsu <tonypottera@gmail.com>
@justinchuby justinchuby enabled auto-merge October 11, 2024 22:42
@justinchuby justinchuby added this pull request to the merge queue Oct 11, 2024
Merged via the queue into onnx:main with commit 9bde3ce Oct 11, 2024
33 checks passed
@tonypottera24 tonypottera24 deleted the big-model-patch branch October 11, 2024 23:01
@ramkrishna2910 ramkrishna2910 added the module: utility Helper modules label May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: utility Helper modules
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants