cyy
6ac8bc0cd2
Remove unused import in tests ( #146266 )
...
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/146266
Approved by: https://github.com/Skylion007
2025-02-03 03:40:18 +00:00
Yanan Cao (PyTorch)
ba5cacbc17
[Codemod][AddExplicitStrictExportArg] caffe2/test ( #143688 )
...
Reviewed By: avikchaudhuri
Differential Revision: D67530154
Pull Request resolved: https://github.com/pytorch/pytorch/pull/143688
Approved by: https://github.com/tugsbayasgalan
2024-12-27 07:58:44 +00:00
angelayi
f14f245747
[export] Remove custom forward func in swap ( #139126 )
...
Differential Revision: [D65100694](https://our.internmc.facebook.com/intern/diff/D65100694 )
Remove the custom forward function and instead move the pytree flatten/unflatten ops into the graph. This allows us to natively run via the interpreter.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/139126
Approved by: https://github.com/avikchaudhuri
2024-10-30 16:50:57 +00:00
angelayi
1dc1b85714
[export] Move swap to a different file ( #137134 )
...
Refactor so that unflattener doesn't become too messy
Differential Revision: [D63719648](https://our.internmc.facebook.com/intern/diff/D63719648/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/137134
Approved by: https://github.com/avikchaudhuri
ghstack dependencies: #136191 , #137102
2024-10-06 04:28:18 +00:00
angelayi
fa9cd46d12
[export] Update swap's forward function ( #137102 )
...
Downstream APS code was failing to run the previously swapped module because of some fx.GraphModule forward function weirdness (P1594789677). So to fix this, I just attached a custom forward function which matches the unflattened module's forward function.
Differential Revision: [D63683422](https://our.internmc.facebook.com/intern/diff/D63683422/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/137102
Approved by: https://github.com/avikchaudhuri
ghstack dependencies: #136191
2024-10-06 04:25:36 +00:00
angelayi
52d7704b32
[export] Add optimization passes ( #136191 )
...
Added an optimization pass to the swap function which removes extraneous pytrees. Currently it removes the pytree flatten/unflatten calls between modules in very specific scenarios (all the inputs of one module go into the other).
Future work can be to remove the input pytree.flatten if the inputs go directly into an unflatten, and output pytree unflatten if the outputs are directly from a pytree.flatten.
Differential Revision: [D62879820](https://our.internmc.facebook.com/intern/diff/D62879820 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/136191
Approved by: https://github.com/avikchaudhuri
2024-10-06 04:22:42 +00:00
angelayi
210b136c07
[export] Add experimental swap API ( #136190 )
...
Prototyped the following API which takes in an ExportedProgram, a dictionary of fqn to modules to swap, and returns a (unlifted) GraphModule
```
_swap_modules(
ep: ExportedProgram, modules_to_swap: Dict[str, torch.nn.Module]
) -> torch.fx.GraphModule:
```
Differential Revision: [D62879819](https://our.internmc.facebook.com/intern/diff/D62879819 )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/136190
Approved by: https://github.com/avikchaudhuri
2024-09-24 22:50:44 +00:00