[Executorch][custom ops] Change lib loading logic to account for package dir#7211
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/7211
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 5c05f89 with merge base 3be3b92 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
kimishpatel
approved these changes
Dec 6, 2024
Contributor
|
@pytorchbot rebase -b main |
…age dir Pull Request resolved: #7038 Just looking at the location of the source file. In this case custom_ops.py, can, and does, yield to wrong location depending on where you import custom_ops from. If you are importing custom_ops from another source file inside extension folder, e.g. builder.py that is in extensions/llm/export, then, I think, custom_ops gets resolved to the one installed in site-packages or pip package. But if this is imported from say examples/models/llama/source_transformations/quantized_kv_cache.py (Like in the in next PR), then it seems to resolve to the source location. In one of the CI this is /pytorch/executorch. Now depending on which directory your filepath resolves to, you will search for lib in that. This of course does not work when filepath resolves to source location. This PR changes that to resolve to package location. ghstack-source-id: 256711930 //unit-test-arm broken in trunk @bypass-github-export-checks @exported-using-ghexport Differential Revision: [D66385480](https://our.internmc.facebook.com/intern/diff/D66385480/)
ce7a29c to
5c05f89
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was created by the merge bot to help merge the original PR into the main branch.
ghstack PR number: #7038
^ Please use this as the source of truth for the PR details, comments, and reviews
ghstack PR base: https://github.com/pytorch/executorch/tree/gh/kimishpatel/146/base
ghstack PR head: https://github.com/pytorch/executorch/tree/gh/kimishpatel/146/head
Merge bot PR base: https://github.com/pytorch/executorch/tree/gh/kimishpatel/144/orig
Merge bot PR head: https://github.com/pytorch/executorch/tree/gh/kimishpatel/146/orig
@diff-train-skip-merge