Skip to content

Copy weights file to epctx output directory #648

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

Draft
wants to merge 1 commit into
base: ovep-develop
Choose a base branch
from

Conversation

ericcraw
Copy link

No description provided.

}
const auto& sw_path_filename = shared_context_->shared_weights.external_weight_filename;
fs::path new_weights_file_path = session_context_.GetNewWeightsFilePath(sw_path_filename);
fs::path original_weights_path = session_context_.GetModelDirectory() / sw_path_filename;

Choose a reason for hiding this comment

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

This is not quite right. There's an ORT option for setting the weights path when for whatever reason the relative path between model and weight was altered from when the model was generated. For example if an initializer in the model has location = "weights.bin" then the file weights.bin is expected to be in the same folder as the model. If the weights are instead in "path\weights.bin" then session option ep.context_model_external_initializers_file_name MUST be set to "path".

In summary this needs a

fs::path GetWeightsDirectory() const {
    return so_context_model_external_initializers_file_name.empty() ? GetModelDirectory() : so_so_context_model_external_initializers_file_name;
}

Choose a reason for hiding this comment

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

Based on yesterday's discussion we're not going to deal with context_model_external_initializers_file_name in this PR


auto weight_path = session_context_.GetNewWeightsFilePath(sw.external_weight_filename);
if (!std::filesystem::exists(weight_path)) {
weight_path = session_context_.GetModelDirectory() / sw.external_weight_filename;

Choose a reason for hiding this comment

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

Same comment as below

@ericcraw ericcraw force-pushed the model_weights_copy branch from 887f644 to 71479b3 Compare April 10, 2025 23:23
@ericcraw ericcraw force-pushed the model_weights_copy branch from 71479b3 to aeccbc5 Compare April 11, 2025 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants