Skip to content

vitisai/imp/graph.cc: fix graph_save() for models with external data #25082

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

Merged

Conversation

schuermans-slx
Copy link
Contributor

Description

This fixes the export of a model to disk (e.g. for debugging) in case the original model uses an external data file.
Before, the external data file was not found if the model is exporter to a different directory than the original model.

Motivation and Context

Reading initializer data from an external data file happens on demand and uses the name of the model file to determine the directory containing the data file.
Thus, when creating a new Model object in memory for the export to disk, it is important to use the path to the original model file in that object instead of the path to the model file to be exported to disk. This ensures that the original data file can still be found for reading the initializer data during the export.

Reading initializer data from an external data file happens on demand and
uses the name of the model file to determine the directory containing the
data file.
Thus, when creating a new Model object in memory for the export to disk,
it is important to use the path to the original model file in that
object instead of the path to the model file to be exported to disk.
This ensures that the original data file can still be found for reading
the initializer data during the export.
@schuermans-slx schuermans-slx force-pushed the fix_vitisai_graph_save_ext_data branch from aba1865 to 49547f8 Compare June 16, 2025 11:51
@HectorSVC
Copy link
Contributor

/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@HectorSVC HectorSVC added the ep:VitisAI issues related to Vitis AI execution provider label Jun 16, 2025
Copy link
Contributor

@HectorSVC HectorSVC left a comment

Choose a reason for hiding this comment

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

:shipit:

@HectorSVC HectorSVC merged commit 20b2247 into microsoft:main Jun 16, 2025
83 checks passed
guschmue pushed a commit that referenced this pull request Jun 17, 2025
…25082)

### Description

This fixes the export of a model to disk (e.g. for debugging) in case the original model uses an external data file.
Before, the external data file was not found if the model is exporter to a different directory than the original model.

### Motivation and Context

Reading initializer data from an external data file happens on demand and uses the name of the model file to determine the directory containing the data file.
Thus, when creating a new Model object in memory for the export to disk, it is important to use the path to the original model file in that object instead of the path to the model file to be exported to disk.
This ensures that the original data file can still be found for reading the initializer data during the export.

Co-authored-by: Stefan Schuermans <stefan.schuermans@amd.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:VitisAI issues related to Vitis AI execution provider
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants