-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[AOTInductor] Option to not include weight in .so #141997
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/141997
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (3 Unrelated Failures)As of commit 31e6b93 with merge base d648133 ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D65968885 |
e3542c1 to
9dec2a8
Compare
|
This pull request was exported from Phabricator. Differential Revision: D65968885 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D65968885 |
9dec2a8 to
eb78637
Compare
Summary: Add an option in config to not include weights in .so Test Plan: `test/inductor:test_aot_inductor -- -r test_so_without_weight_cuda` Reviewed By: desertfire Differential Revision: D65968885
eb78637 to
31e6b93
Compare
|
This pull request was exported from Phabricator. Differential Revision: D65968885 |
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: With the changes in #140755 and #141997, I added a load_constants function to the packaging API. Currently this doesn't work for cpu. The workflow is something like: ``` ep = torch.export.export(model, example_inputs) package = torch._inductor.aoti_compile_and_package(ep, inductor_configs=inductor_configs) compiled = torch._inductor.aoti_load_package(package) print(compiled.get_constant_fqns()) # see what are the fqns needed/available compiled.load_constants(new_state_dict, check_full_update=True) # update the constants in AOTI ``` You can also use the `aot_inductor.package_constants_in_so` config to stop including the constants in the so: ``` package = torch._inductor.aoti_compile_and_package(ep, inductor_configs={`aot_inductor.package_constants_in_so`: False) compiled = torch._inductor.aoti_load_package(package) compiled(*inputs) # segfaults because there are no constants --> we should probably have a better error msg compiled.load_constants(new_state_dict, check_full_update=True) compiled(*inputs) ``` Test Plan: `buck2 run @//mode/dev-nosan //caffe2/test/inductor:aot_inductor_package -- -r "test_so_without_weight" ` Differential Revision: D66796206
Summary: Pull Request resolved: pytorch#142246 With the changes in pytorch#140755 and pytorch#141997, I added a load_constants function to the packaging API. Currently this doesn't work for cpu. The workflow is something like: ``` ep = torch.export.export(model, example_inputs) package = torch._inductor.aoti_compile_and_package(ep, inductor_configs=inductor_configs) compiled = torch._inductor.aoti_load_package(package) print(compiled.get_constant_fqns()) # see what are the fqns needed/available compiled.load_constants(new_state_dict, check_full_update=True) # update the constants in AOTI ``` You can also use the `aot_inductor.package_constants_in_so` config to stop including the constants in the so: ``` package = torch._inductor.aoti_compile_and_package(ep, inductor_configs={`aot_inductor.package_constants_in_so`: False) compiled = torch._inductor.aoti_load_package(package) compiled(*inputs) # segfaults because there are no constants --> we should probably have a better error msg compiled.load_constants(new_state_dict, check_full_update=True) compiled(*inputs) ``` Test Plan: `buck2 run @//mode/dev-nosan //caffe2/test/inductor:aot_inductor_package -- -r "test_so_without_weight" ` Reviewed By: henrylhtsang Differential Revision: D66796206
Summary: With the changes in #140755 and #141997, I added a load_constants function to the packaging API. Currently this doesn't work for cpu. The workflow is something like: ``` ep = torch.export.export(model, example_inputs) package = torch._inductor.aoti_compile_and_package(ep, inductor_configs=inductor_configs) compiled = torch._inductor.aoti_load_package(package) print(compiled.get_constant_fqns()) # see what are the fqns needed/available compiled.load_constants(new_state_dict, check_full_update=True) # update the constants in AOTI ``` You can also use the `aot_inductor.package_constants_in_so` config to stop including the constants in the so: ``` package = torch._inductor.aoti_compile_and_package(ep, inductor_configs={`aot_inductor.package_constants_in_so`: False) compiled = torch._inductor.aoti_load_package(package) compiled(*inputs) # segfaults because there are no constants --> we should probably have a better error msg compiled.load_constants(new_state_dict, check_full_update=True) compiled(*inputs) ``` Test Plan: `buck2 run @//mode/dev-nosan //caffe2/test/inductor:aot_inductor_package -- -r "test_so_without_weight" ` Differential Revision: D66796206 Pull Request resolved: #142246 Approved by: https://github.com/henrylhtsang, https://github.com/desertfire
Summary: Add an option in config to not include weights in .so Test Plan: `test/inductor:test_aot_inductor -- -r test_so_without_weight_cuda` Reviewed By: desertfire Differential Revision: D65968885 Pull Request resolved: #141997 Approved by: https://github.com/desertfire
Summary: With the changes in #140755 and #141997, I added a load_constants function to the packaging API. Currently this doesn't work for cpu. The workflow is something like: ``` ep = torch.export.export(model, example_inputs) package = torch._inductor.aoti_compile_and_package(ep, inductor_configs=inductor_configs) compiled = torch._inductor.aoti_load_package(package) print(compiled.get_constant_fqns()) # see what are the fqns needed/available compiled.load_constants(new_state_dict, check_full_update=True) # update the constants in AOTI ``` You can also use the `aot_inductor.package_constants_in_so` config to stop including the constants in the so: ``` package = torch._inductor.aoti_compile_and_package(ep, inductor_configs={`aot_inductor.package_constants_in_so`: False) compiled = torch._inductor.aoti_load_package(package) compiled(*inputs) # segfaults because there are no constants --> we should probably have a better error msg compiled.load_constants(new_state_dict, check_full_update=True) compiled(*inputs) ``` Test Plan: `buck2 run @//mode/dev-nosan //caffe2/test/inductor:aot_inductor_package -- -r "test_so_without_weight" ` Differential Revision: D66796206 Pull Request resolved: #142246 Approved by: https://github.com/henrylhtsang, https://github.com/desertfire
Summary: Add an option in config to not include weights in .so
Test Plan:
test/inductor:test_aot_inductor -- -r test_so_without_weight_cudaReviewed By: desertfire
Differential Revision: D65968885
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @ColinPeppler @amjames @desertfire @chauhang @aakhundov