-
Notifications
You must be signed in to change notification settings - Fork 295
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
Refactor some APIs #3863
Refactor some APIs #3863
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3863
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit fe62256 with merge base 91c0485 (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D58101124 |
This pull request was exported from Phabricator. Differential Revision: D58101124 |
…g flow, and call print_ops_info in export_to_executorch (#3863) Summary: Pull Request resolved: #3863 The current setup is unbalanced, especially because we would love to (and should) use the `print_ops_info` function better. Currently, it's not used in the calls most people would want to do on Bento for example. For one-liner compilation (e.g. calling `export_to_executorch`), the information should be printed. This diff refactors both the APIs in `__init__.py` and `utils.py`, so that the breakdown makes more sense. Arguably it should be a stack of diffs, but it mostly all goes hand in hand IMO. Main changes: - create an `export_edge_to_executorch` API, which takes in an `EdgeProgramManager`. This is useful because we want to keep the edge graph module around to pass it in `print_ops_count` - calls `print_ops_info` in `export_to_executorch` - call `export_to_executorch` in `run_and_verify`, using the exported module - introduce a `model_is_quantized()` util to call the right API when trying to make models eval. The check on the `GraphModule` type is not robust enough, since other models could be `GraphModule`s but not be quantized. If that's the case, we assert that they have been exported already, which makes the `eval()` requirement moot. Differential Revision: D58101124
08125db
to
c4a09b0
Compare
…g flow, and call print_ops_info in export_to_executorch (#3863) Summary: The current setup is unbalanced in the way we call different APIs, especially because we would love to (and should) use the `print_ops_info` function better. Currently, it's not used in the calls most people would want to do on Bento for example. For one-liner compilation (e.g. calling `export_to_executorch`), the information should be printed. `export_to_executorch` should also be called in the testing flow. This diff refactors both the APIs in `__init__.py` and `utils.py`, so that the breakdown makes more sense. Arguably it should be a stack of diffs, but it mostly all goes hand in hand IMO so I kept it as one. Main changes: - create an `export_edge_to_executorch` API, which takes in an `EdgeProgramManager`. This is useful because we want to keep the edge graph module around to pass it in `print_ops_count`, and now we can use it in `export_to_executorch` (see next point) - calls `print_ops_info` in `export_to_executorch`, now that the edge graph is exposed there - call `export_to_executorch` in `run_and_verify`, using the exported module. This required changing the checks for `eval()` mode, see next point. - introduce a `model_is_quantized()` util to call the right API when trying to make models eval. The check on the `GraphModule` type is not robust enough, since other models could be `GraphModule`s but not be quantized. If that's the case, we assert that they have been exported already, which makes the `eval()` requirement moot. Reviewed By: dulinriley, zonglinpengmeta Differential Revision: D58101124
c4a09b0
to
fe62256
Compare
This pull request was exported from Phabricator. Differential Revision: D58101124 |
This pull request has been merged in d928066. |
Summary:
introduce an
is_quantized()
util to call the right API when trying to make models eval. The check on theGraphModule
type is not robust enough, since other models could beGraphModule
s but not be quantized.Differential Revision: D58101124