[Feature][Diffusion] Add BOOGU Image sequence parallel support (#5718)
Signed-off-by: Xenoryn <timberh2000@outlook.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
12 files changed
+1461
-68
No files matched your search
@@ -64,6 +64,10 @@ class ForwardContext:
|
||||
sp_padding_size: int = 0
|
||||
# Original sequence length before padding (for removing padding in gather)
|
||||
sp_original_seq_len: int | None = None
|
||||
# Pre-padding global sequence length per SequenceParallelInput shard_group,
|
||||
# for models that auto-pad several independent sequences in one boundary.
|
||||
# The singleton fields above remain for single-sequence models.
|
||||
sp_shard_metadata: dict[str, int] = field(default_factory=dict)
|
||||
|
||||
# Set by registry when _sp_plan hooks are applied.
|
||||
# When True, sp_active is determined by _sp_shard_depth (for _sp_plan hooks)
|
||||
@@ -127,6 +131,13 @@ def is_forward_context_available() -> bool:
|
||||
return _forward_context is not None
|
||||
|
||||
|
||||
def get_sp_shard_original_seq_len(shard_group: str) -> int | None:
|
||||
"""Pre-padding global length of `shard_group`, or None if it was not split."""
|
||||
if not is_forward_context_available():
|
||||
return None
|
||||
return get_forward_context().sp_shard_metadata.get(shard_group)
|
||||
|
||||
|
||||
def build_local_sp_padding_mask(
|
||||
batch_size: int,
|
||||
local_seq_len: int,
|
||||
|
||||
Reference in new issue
Block a user