Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix AddOliveMetadata pass to preserve external data files#1974

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ashrit-ms wants to merge6 commits intomain
base:main
Choose a base branch
Loading
fromashritms/preserve-external-data

Conversation

ashrit-ms
Copy link
Contributor

Describe your changes

Refactored the AddOliveMetadata ONNX pass to ensure all external data files (e.g., .bin, .xml) are preserved when adding metadata to ONNX models.

Key changes:

  • Always copy entire input directory to output location to preserve all external files alongside the main ONNX model
  • Simplified pass logic by treating all models as directory-based
  • Load ONNX models without external data to preserve file structure
  • Return directory-based ONNXModelHandler for consistent behavior

Added unit tests:

  • test_add_metadata_with_external_data_files: Verifies external file preservation for directory-based models with mock .bin/.xml
  • test_add_metadata_single_file_to_directory_conversion: Ensures correct metadata handling for single-file ONNX models

This fix addresses issues where external data files were lost during metadata addition, ensuring model integrity for ONNX/OpenVINO models with external dependencies.

@ashrit-msashrit-ms self-assigned thisJul 14, 2025
@ashrit-msashrit-msforce-pushed theashritms/preserve-external-data branch fromf4ca5c4 to82285a9CompareJuly 14, 2025 22:34
Refactored the AddOliveMetadata ONNX pass to ensure all externaldata files (e.g., .bin, .xml) are preserved when adding metadata to ONNXmodels.Key changes:- Always copy entire input directory to output location to preserve  all external files alongside the main ONNX model- Simplified pass logic by treating all models as directory-based- Load ONNX models without external data to preserve file structure- Return directory-based ONNXModelHandler for consistent behaviorAdded comprehensive unit tests:- test_add_metadata_with_external_data_files: Verifies external  file preservation for directory-based models with mock .bin/.xml- test_add_metadata_single_file_to_directory_conversion: Ensures  correct metadata handling for single-file ONNX modelsThis fix addresses issues where external data files were lost duringmetadata addition, ensuring model integrity for ONNX/OpenVINO modelswith external dependencies.
@ashrit-msashrit-msforce-pushed theashritms/preserve-external-data branch froma5f1540 toa0f83c1CompareJuly 17, 2025 17:48
onnx_files = list(input_model_path.glob("*.onnx"))
if not onnx_files:
raise ValueError(f"No ONNX file found in model directory: {input_model_path}")
input_onnx_file = onnx_files[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Will this work for multi-modal scenario?

It would be safer to use only if a single modal is found. In other cases throw a relevant error and ask the user to explicitly provider a model file name.

Copy link
ContributorAuthor

@ashrit-msashrit-msJul 18, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just want to confirm if you referring to multi mod'e'l scenarios or multi mod'a'l scenarios?

For multi model scenarios, Olive automatically applies the pass to each component of a composite model.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@shaahjishaahjishaahji requested changes

Requested changes must be addressed to merge this pull request.

Assignees

@ashrit-msashrit-ms

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@ashrit-ms@shaahji

[8]ページ先頭

©2009-2025 Movatter.jp