-
Notifications
You must be signed in to change notification settings - Fork 3.9k
fix: CoreML EP crash when loading model with external data file #28043
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -357,9 +357,12 @@ Status TensorProtoWithExternalDataToTensorProto( | |
| ++data; | ||
| } | ||
| } else { | ||
| // Load the external data into memory | ||
| // Load the external data into memory. | ||
| // model_path is the full model file path (e.g., "/path/to/model.onnx"). | ||
| // ReadExternalDataForTensor expects the parent directory, matching the | ||
| // pattern used by UnpackInitializerData() at line ~2572. | ||
| std::vector<uint8_t> unpacked_data; | ||
| ORT_RETURN_IF_ERROR(ReadExternalDataForTensor(ten_proto, model_path, unpacked_data)); | ||
| ORT_RETURN_IF_ERROR(ReadExternalDataForTensor(ten_proto, model_path.parent_path(), unpacked_data)); | ||
|
Comment on lines
+360
to
+365
|
||
|
|
||
| // Set the raw data in the new tensor | ||
| onnxruntime::utils::SetRawDataInTensorProto(result, unpacked_data.data(), unpacked_data.size()); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new comment hard-codes a reference to a specific line number in UnpackInitializerData ("line ~2572"). Line-number references tend to go stale quickly and make the comment misleading over time. Consider rewording to reference the function/behavior instead (e.g., that UnpackInitializerData passes model_path.parent_path()) without citing a line number.