Repository navigation
[Auto-Parallel] add fully_shard - #76868
Merged
Merged
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
liym27
reviewed
Dec 16, 2025
| offload_policy, | ||
| ignored_params, | ||
| ): | ||
| FullyShardAuto(module, mesh) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #76868 +/- ##
===========================================
Coverage ? 100.00%
===========================================
Files ? 3
Lines ? 32
Branches ? 0
===========================================
Hits ? 32
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jeff41404
reviewed
Dec 19, 2025
Comment on lines
+74
to
+84
| def fully_shard( | ||
| module: paddle.nn.Layer, | ||
| *, | ||
| mesh: dist.ProcessMesh = None, | ||
| reshard_after_forward: bool | int | None = None, | ||
| shard_placement_fn: Callable[[paddle.Tensor], dist.Shard | None] | ||
| | None = None, | ||
| mp_policy: MixedPrecisionPolicy | None = None, | ||
| offload_policy: OffloadPolicy | None = None, | ||
| ignored_params: Iterable[paddle.Tensor] | None = None, | ||
| ) -> paddle.nn.Layer: |
jeff41404
reviewed
Dec 19, 2025
| from .group_sharded import group_sharded_parallel, save_group_sharded_model | ||
|
|
||
| __all__ = ['group_sharded_parallel', 'save_group_sharded_model'] | ||
| __all__ = ['group_sharded_parallel', 'save_group_sharded_model', "fully_shard"] |
Contributor
There was a problem hiding this comment.
建议用户使用的路径是paddle.distributed.sharding.fully_shard 么?是否增加别名兼容业界?
Contributor
Author
There was a problem hiding this comment.
已修改fully_shard路径,感谢
liym27
reviewed
Dec 19, 2025
SigureMo
approved these changes
Dec 19, 2025
Comment on lines
+18
to
+22
| if TYPE_CHECKING: | ||
| from collections.abc import Iterable | ||
|
|
||
| import paddle | ||
| import paddle.distributed as dist |
Collaborator
There was a problem hiding this comment.
放在 27 行之后,不要让 TYPE_CHECKING 把 import 分隔开
| ) | ||
|
|
||
|
|
||
| # @dataclass |
| cast_forward_inputs: bool = True | ||
|
|
||
|
|
||
| # @dataclass |
Comment on lines
+79
to
+80
| shard_placement_fn: Callable[[paddle.Tensor], dist.Shard | None] | ||
| | None = None, |
Collaborator
There was a problem hiding this comment.
Suggested change
| shard_placement_fn: Callable[[paddle.Tensor], dist.Shard | None] | |
| | None = None, | |
| shard_placement_fn: (Callable[[paddle.Tensor], dist.Shard | None] | |
| | None = None), |
这里格式化的优点难看,试试包一个括号再重新格式化呢?
| Examples: | ||
| .. code-block:: python | ||
|
|
||
| >>> # type: ignore |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
Auto Parallel
PR Types
Others
Description
添加FSDP接口fully_shard,动手/动半统一接口,model = fully_shard(model, ...)
具体实现逻辑:#76770
card-92763