KEMBAR78
[AOTInductor] Option to not include weight in .so by muchulee8 · Pull Request #141997 · pytorch/pytorch · GitHub
Skip to content

Conversation

@muchulee8
Copy link
Contributor

@muchulee8 muchulee8 commented Dec 3, 2024

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

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @ColinPeppler @amjames @desertfire @chauhang @aakhundov

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 3, 2024

🔗 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 (image):

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.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65968885

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65968885

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65968885

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
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65968885

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Dec 4, 2024
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

pytorch-bot bot pushed a commit that referenced this pull request Dec 6, 2024
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
angelayi added a commit to angelayi/pytorch that referenced this pull request Dec 6, 2024
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
pytorchmergebot pushed a commit that referenced this pull request Dec 7, 2024
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
pytorch-bot bot pushed a commit that referenced this pull request Dec 9, 2024
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
pytorch-bot bot pushed a commit that referenced this pull request Dec 9, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants