Commit Graph

3 Commits

Author SHA1 Message Date
Xuehai Pan
758a0a88a2 [BE][Easy] enable ruff rule PIE790: unnecessary pass statement (#133200)
This PR removes unnecessary `pass` statement. This is semanticly safe because the bytecode for the Python code does not change.

Note that if there is a docstring in the function, a empty function does not need a `pass` statement as placeholder.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/133200
Approved by: https://github.com/malfet, https://github.com/eqy, https://github.com/kit1980
2024-08-15 15:50:19 +00:00
Xuehai Pan
22d258427b [BE][Easy] enable UFMT for torch/distributed/_shard/ (#128867)
Part of #123062

- #123062

Pull Request resolved: https://github.com/pytorch/pytorch/pull/128867
Approved by: https://github.com/fegin
ghstack dependencies: #128866
2024-06-18 14:39:25 +00:00
Wanchao Liang
a37141addd [shard] Extensible Sharder and ShardingPlanner (#75844)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/75844

Add extensible Sharder and ShardingPlanner for advanced users to extend and do custom sharding, some details:

* ShardingPlanner is merely a interface that could be extended to plan advanced sharding strategies, it will produce a ShardingPlan that outlines the detailed sharding strategies for each submodule, note that it could also include custom sharders.
* a custom Sharder is another interface that could be extended to define advanced sharding strategies for specific modules (i.e. a collection of `nn.EmbeddingBag`s.) The custom sharder defined by the user can be picked up by `share_module` API. `shard_module` will call `Sharder.shard` to the module, the output of the `Sharder.shard` will replace the original submodule.

ghstack-source-id: 154978919

Test Plan:
test_sharder
test_sharding_plan

Reviewed By: pritamdamania87

Differential Revision: D35658657

fbshipit-source-id: ad9deb39a6a0ab91ceb1de3a78c4709aa50ad699
(cherry picked from commit f9796471bd7f8ad94a9d3462cac30eacacf68b31)
2022-04-28 04:11:10 +00:00